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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need my code to link to field names with spaces??

Status
Not open for further replies.

ChrisHaynes

Technical User
Mar 9, 2006
80
0
0
GB
Hi, I have a code which links a combo box to fields in a query. It works for all the fields with no spaces between the words. How can I edit the code to work with fields with spaces? I have tried entering brackets but this hasn't worked. Can anyone help??


=DLookUp([Forms]![frm_Software_Home]![Combo160],"qry_totalUsers")


Thanks alot
Chris.
 
Brackets are the ticket
Code:
=DLookUp([COLOR=red]"[" & [/color][Forms]![frm_Software_Home]![Combo160][COLOR=red] & "]"[/color],"qry_totalUsers")
 
Hi Golom, that makes sense but now I'm getting a 'Type Mismatch' error message??

Any ideas??
 
What is the field name? "frm_Software_Home" or
"frm Software Home"?

if it is the first one, then it should be fine. If it is the second one, then remove the underscores.

Let me know if that works.

-- Fast Learner, I Think

Here's something to think about. How come you never see a headline like 'Psychic Wins Lottery!'? - Jay Leno
 
Thanx alot for both of you're help. I have it working now. I had renamed my combo box to 'test' and had not changed the code from 'Combo160'. And the comma's are working perfect for fields with spaces.

Thanx again guys.

Chris
 
or simply
forms("Any Badly Named form").combo160

controls("Control Name")
fields("Field Name")

Second stop naming fields with spaces. This is just bad programming and your begging for problems. To learn how to name properly here is a good link

To understand why this is bad (as you have already seen)
FAQ700-2190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top