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
PC Datasheet - 26 Nov 2003 18:07 GMT
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?)
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource@pcdatasheet.com
www.pcdatasheet.com
> I have a form called FormA. It is bound to TableA.
>
[quoted text clipped - 22 lines]
>
> Thanks
Charles Kingsley - 26 Nov 2003 18:16 GMT
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.
> 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
[quoted text clipped - 32 lines]
> >
> > Thanks
PC Datasheet - 26 Nov 2003 20:09 GMT
In the original table, was the field name a reserved word?
Steve
PC Datasheet
> 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
[quoted text clipped - 44 lines]
> > >
> > > Thanks
Jayathirth - 11 Aug 2006 15:56 GMT
Real Magic Indian Oil from traditional Indian herbs.
FREE TRIAL FOR 500 customers (5ml bottle), Ring +91 9810577227