Source Code won't update properly

MsfStl

Registered User.
Local time
Today, 11:37
Joined
Aug 31, 2004
Messages
74
Hi, I am createing a simple data entry with VBA in Access2000. My problem is that while in VBA to code somethings behind the scenes, the VBA doesn't pull all of the Objects from my table. e.g., I have a variable called SchDARE. Normally while coding I can type 'Me.' and the object list will drop down and will narrow to the object I am looking for as I continue to type. My problem is that the VBA is missing a few of the table variables. These are Numeric variables, nothing abnormal, and I am connecting them to individual checkboxes. Additionally as I save a record at the end of a complete entry I use VBA to recode the check box values within the table (we use different Y/N values;Yes = 5 and No=1, rather than the 0, -1). The program barks at me and says it doesn't recognize the variables. Why is VBA not reading the original variables from the table?

Thanks in advance,
Scot
 
MsfStl said:
I have a variable called SchDARE. Scot

Where is this?

Is it in a form class module?

If not, where is it?
 
The variable itself is in the table the checkbox I am trying to link it to is in the form. By default the boolean value is -1 And 0. So when I try to recode the value at the entry level VBA doesn't pick up the variable.

Oh...this was added after I created the form. If I could update the list I don't think I wuld have a problem.

Scot
 
Ok, I fixed it by creating a 2nd form, which then had an updated variable list in the VBA list and then I copied my objects and VBA code from the first form and then deleted those. It works fine. Still it seems that I should be able to update the VBA side with the any variables I might create after the form has been created, don't you think?
 
You're not really talking about variables so it is best to not call them that. Call them columns or fields. Variables are what you define with Dim statements in your VBA code.

To refresh the fields collection of a form or report, delete the form's RecordSource, move the cursor into a different property so the change registers, then go back to the RecordSource and paste the original value back.

Access doesn't refresh the fields collection when the RecordSource is a query. It has no way of knowing that you modified the query so you have to force the issue.
 

Users who are viewing this thread

Back
Top Bottom