Compile Error - fieldname.setfocus

F

FatMan

Hi all:
I am tyring to compile a dataase I created and have tested. It seems to
work exactly like I would like it to, yet when I go to compile it I get the
following error message....."Method or data member not found.". When I click
OK it takes me to a line of code that is simply "fieldname.setfocus". I
don't understand why it would work when I test/use the form and the auto
syntax checker finds no problem with it.....why would there be a problem when
I compile the code?

Can someone help me here please?

Thanks.
 
B

Brendan Reynolds

Well, a field doesn't have a SetFocus method. A form control does. Is
"fieldname" the name of a control on the form?

Also, although in theory it shouldn't make any difference, I have
occasionally encountered strange behaviour when I omitted the keyword "Me"
from code like this, e.g. strange things would happen when I wrote
"ControlName.SetFocus" that stopped happening when I changed it to
"Me!ControlName.Setfocus".

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
B

Brendan Reynolds

If this is a copy-and-paste of the actual code, then you appear to have
misspelled a field name - "GrowerFristName" instead of "GrowerFirstName".
But perhaps that was just a typo in the newsgroup post? If so, try using !
instead of ., e.g. Me!GrowerLastName & " " & Me!GrowerFirstName.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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