Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference to a form in Access with a name with a space in it?

Status
Not open for further replies.

roundup

Programmer
Dec 4, 2008
3
US
Hi all,

I know this might be a really dumb question, but I just have my own database that I work on as a hobby. I need some handy code in VBA but don't know how to reference this dlookup properly:

Quantity = DLookup("[units]", "Scouting Query", "[Scouting ID] = Form!Scouting Form![Scouting ID] ")

The Form!Scouting Form!

is the part that is incorrect, please help, THANKS

Scouting Form is the name of the form that I want to get the scouting id from.
 
Same way as you handled the field name with a space in it. Or better yet do yourself a favor and fix all tables and field names. Scouting_ID not Scouting ID. It is so much extra work if your object names have spaces.
 

And if you decide to go with names with no spaces in them (that would be a very good idea, BTW), remember also NOT to use words that are/could be reserved words, like Time, Now, Select, Name, etc. Instead consider: frmTime, txtNow, blnSelect, strName, etc.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top