Reference a record in table from a form

  • Thread starter Thread starter Charles Kingsley
  • Start date Start date
C

Charles Kingsley

I have a form called FormA. It is bound to TableA.

In FormA, I want to reference one of the fields in TableA, lets say FieldA.

Nornally I would have a text box control in the form and it's control source
would be FieldA and any code that I would use would reference the text box
control. All is fine and dandy.

This time, I want to do away with the text box and assign the current
record's value for FieldA to a variable.

In one database, I used this syntax in a VB module:

MyVariable= Me.FieldA

It works fine. That is MyVariable is given the value of the current
record's FieldA from the form's bound table, without the need of a text box
control.

I tried using the same syntax in another database but get a "Method or Data
member not found" error. If I use MyVariable= Me!FieldA (replacing the dot
with an exclamation point), it works fine.

Why?

Thanks
 
Use a bang "!" to reference objects and controls and a dot "." to reference
methods and properties and you won't run into this problem! (or should that end
in with a dot?)
 
Thanks...but why does it work in one database but not the other ? The
second database is a copy of the first one. The only difference is that I
changed the names of the fields in the tables.
 
Back
Top