Topics Search

Enable fields VBA

Enable fields VBA
Views: 14
When I update a combo box to "Active," I want multiple fields to be enabled. I know the way to do it field by field. Example:

If Status = "Active" Then
Trial.Enabled = True
Else
Trial.Enabled=False
End If

Since there are several fields, is there a way to group those fields and name the GROUP of fields, so I don't have to do each one individually? I'm thinking something like this:

If Status = "Active" Then
Group1.Enabled = True
Else
Group1.Enabled=False
Sponsored Links:

More topics

 

Subform fields lock/unlock enable/disable from userinput

Preview
Re: Controlling fields in a subform from a combo list value VBA:
Field names:
cboActivity - this combo box lists the Activity Numbers (i.e 1.1, 1.2, 1.3, 2.1, 2.2, 3.1)
txtStartDate - this date field is an Input field
txtEndDate - this date field is an Input field
txtQuantity - this text field is an Input field
txtStartDepth - this text field is an Input field
txtEndDepth - this text field is an Input field

Goal / Solution Required: I would like the subform to lock the last three text fields (txtQuantity, txtStartDepth, txtEndDepth) on load.

I would like to enable these 3 fields for input based on the "cboActivity" value. The following condition to enable the text fields are:
 

Access 2007: Enable Macros on Startup

Preview
Has anyone figured out if it's possible to enable vba macros on startup using a script? In Access 2003 I used application.setoption to tweak a number of application parameters though I'mnot sure if I can use this to enable macros in 2007.

I know that I can manually enable macros through the trust center and I could also add a trusted location (could prob. also automate a registry update to do same). My preference though isto enable macros using a script as over 600 users will, on occasion, use these databases and I don't want to spend my days telling people how to enable macros.
 

Modify properties of a relationship from VBA

Preview
I have an Access 2007 database. In it, I have two related tables with a relationship that has Referential Integrity enabled. In a single instance, I want to enable Cascade Delete so thatall related records in a particular table can be deleted when the primary record is deleted.

Can I modify the property of the relationship from VBA to enable Cascade Delete on this one relationship, carry out the delete operation and then disable the Cascade Delete again?
 

Force user to enable macros

Preview
I've created a login form, but it's currently rendered useless by the Access 2007 security bar when opening the database, which disables the VBA in my form. Also, it puts a close button on the corner of my form which gives any user the option to access my data. Is there any way round this? I have already tried:

1) Fiddle with trust centre settings - this is not an option since a user could take the database to a different PC and the security bar would come back.

2) Change the VBA security setting in the registry - not an option since this would be done on form load via VBA, which is disabled.

I was thinking that maybe there is a way to invoke the security dialogue to prompt the user to enable macros or else immediately close the database.
 

Force user to enable macros

Preview
I've created a login form, but it's currently rendered useless by the Access 2007 security bar when opening the database, which disables the VBA in my form. Also, it puts a close button on the corner of my form which gives any user the option to access my data. Is there any way round this? I have already tried:

1) Fiddle with trust centre settings - this is not an option since a user could take the database to a different PC and the security bar would come back.

2) Change the VBA security setting in the registry - not an option since this would be done on form load via VBA, which is disabled.

I was thinking that maybe there is a way to invoke the security dialog to prompt the user to enable macros or else immediately close the database.
 

"Enable automatic reconnect" possible with VBA?

Preview
I had the problem that Access lost the connection to my MySQL db after a certain time period. Previously I connected via

Constr = "DRIVER={MySQL ODBC 3.51 Driver};Server=" & Server & _ ";port=" & Port & ";user=" & user & ";Password=" & pw & ";Database=" & Datenbank"

Now I connect via DNS set up in the windows control panel. There I checked the box "enable automatic reconnect". With the box checked the connection gets not broken anymore which is great. Now I would like to implement "enable automatic reconnect" in VBA so users of my application do not have to set up a DNS in Windows
 

Enable/Disable form fields based on a combo box selection

Preview
Does anyone have an idea of a code that I could use to enable or disable form fields based on a combo box selection "findPatient". Say, the form opens and the combo box is null, then the form fields are disable but after a selection is made they become enabled.

Please anyone. I will attache the file for your view and code suggestions.

Please check the first form that opens on start up
 

Mcro security

Preview
I am new to Access 2007 but when I go into an application I have to hit the option button to enable the macros. Otherwise nothing runs on the app. Any button I hit does nothing to I enable the macros, which is funny because I do not have any that I made. What Access has I do not know. In any case, if I am enabling the macro to use the applications, why do I not just go into the trust center and enable it permanently?
I know this opens the application to macro viruses, but again if you have to enable it anyway, I am not sure I see the point.
Can someone please let me know if they there would be a reason for not just permanently enabling them.
 

If data changes in the field enable control else disable

Preview
In the Edit form whereby fields are referenced to a table. If any data changes in the field of Edit from (text or number or date ) I want the update control button to enable else disable. How can I do that ?
 

Null Handler for multiple fields

Preview
Evening all,

The VBA/Access question of the day is: Is there a way to get VBA to automatically populate fields with "Undefined" or "Unknown" or "N/A" when those fields do not contain any data. I really don't want to have to NULL define every single field individually or rename the fields and run a loop. If anyone knows a way to do this, I could really use the input and would be very greatful for the knowledge