References to Me.???? fail after conversion

J

Jack

I have converted two Access 97 database to Access 2003. In both cases when I open the converted database in Access 2003 my code stops every time I reference a field on a form using the Me.FieldName syntax. For example if I am setting a string variable called strFName to be equal to the value of a field called txtFName on my form and I use the synta

strFName = Me.txtFNam

I get an error saying that the reference can not be found or is invalid
 
D

Douglas J. Steele

See whether Me!txtFName (or Me.Controls("txtFName")) works. Realistically,
you should be using the bang (!) notation, not the dot (.) notation,
although Access normally lets you get away with it.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Jack said:
I have converted two Access 97 database to Access 2003. In both cases when
I open the converted database in Access 2003 my code stops every time I
reference a field on a form using the Me.FieldName syntax. For example if I
am setting a string variable called strFName to be equal to the value of a
field called txtFName on my form and I use the syntax
 
D

david epsom dot com dot au

You can force Access to re-create these properties
by changing (deleting, then adding) the recordsource
for each form. I don't think you can do this in code.

(david)
----

The import/Export stuff seems to work slightly differently
in A2003, and has caused a series of related problems.

object.name is a syntax that refers to properties of object.

When you add a control to the control collection of a form,
Access adds a property to the form class, and connects
the property to the control.

When you add a global variable to a form, Access adds a
property to the form class, and connects the property to
the global variable.

When you bind a form to a recordsource in design mode,
Access adds properties to match the fields in the record
source.

If both controls and fields have the same name, the property
is bound to the control rather than to the field.

Since these properties are part of the form object, you
get 'autocompletion', 'intelesence' and automatic syntax
checking if you use these properties

When you export a form, these properties may not be exported:
they may be re-created when the form is imported.

Under some conditions, these properties may NOT be
exported, imported, or re-created.

-----



Jack said:
I have converted two Access 97 database to Access 2003. In both cases when
I open the converted database in Access 2003 my code stops every time I
reference a field on a form using the Me.FieldName syntax. For example if I
am setting a string variable called strFName to be equal to the value of a
field called txtFName on my form and I use the syntax
 
D

david epsom dot com dot au

you should be using the bang (!) notation, not the dot (.)
although Access normally lets you get away with it.

grrrrrrr, and you should be using SQL, not the QBE grid,
'although Access normally lets you get away with it'

This is the tool we have: it creates a form property for each
control in the controls collection, and a form property for
each field in the fields collection.

(so there!)

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top