Topics Search

Enable fields VBA

Enable fields VBA
Views: 17
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
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
Sponsored Links:

Similar posts...


Subform fields lock/unlock enable/disable from userinput

Subform fields lock/unlock enable/disable from userinput Icon
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

Access 2007: Enable Macros on Startup Icon
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

Modify properties of a relationship from VBA Icon
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?

Null Handler for multiple fields

Null Handler for multiple fields Icon
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

Changin report's fileds with VBA

Changin report's fileds with VBA Icon
I have a report, that is based on a query. I want all the fields in the query to appear on the report. The query uses 3 tables for its data, and one of tables in constantly being deleted/recreated from vba and primary key is being assigned to one of the fields.

Each time the table is recreated, 2 of the fields that are in the query, have their names and data changed. My problem is that when that happens, the query works fine since its SQL is being changed in VBA to reflect the new changes, but the report shows an error in the fields that have beenchanged in the table.

Is there any way for me to dynamically change the report's fields, to the once used in the query.

Force user to enable macros

Force user to enable macros Icon
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.

VBA Code on Form

VBA Code on Form Icon
I am trying to write a VBA access code that will help with displaying an error message to user trying to input new record into table, if 4 fields contain identical data. I have beenworking on this for 2 days straight now, and NOTHING seems to stop that record from inputing into the table.

Table Name: tblAwardsLog
4 fields: LastName , FirstName , Recommended , DateInitiated

All fields are TEXT fields. even DateInitiated

I have this Awards Log almost to where I want it, but just can't seem to get this one thing to work right.

How do I access numbered text fields through vba

How do I access numbered text fields through vba Icon
I have a form in access with 8 fields named (Data1, Data2, Data3, etc.). I would like to change their feature via VBA dependent on user action.

Can I code a do loop that can reference each of the Dataxx fields. for example.

For I = 1 to 8
myField = Data & cstr(I)
next I

I know this wouldn't work, but is there a way to calculate and use a field name?

Declaring from form to VBA

Declaring from form to VBA Icon
When I pass the information from a form to a function in VBA do I have to reformat dates and change the form information that should be numbers to numbers or is this something access will do on its own?

all fields on the form are unbound fields, does the form and vba consider them all strings or not?

"Enable automatic reconnect" possible with VBA?

"Enable automatic reconnect" possible with VBA? Icon
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