Solved Dlookup with spaces in column names (1 Viewer)

murray83

Games Collector
Local time
Today, 12:49
Joined
Mar 31, 2017
Messages
729
Hi All

have been give the task of marinating a database but the column names have spaces and I don't want to change them as It may effect other parts of the DB

but I have a dlookup that I would like/need to add but it just comes back with the ol #error

here is my code

Code:
=DLookUp("[Supplier Name]","tblSupplierDetails","[Supplier Alpha Number]= Forms![frmComplianceFailureDataEntry]!'Supplier Number'")

any help on how to fix this with out breaking the DB would be great

cheers
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:49
Joined
May 7, 2009
Messages
19,245
Code:
=DLookUp("[Supplier Name]","tblSupplierDetails","[Supplier Alpha Number]= Forms![frmComplianceFailureDataEntry]![Supplier Number]")

=DLookUp("[Supplier Name]","tblSupplierDetails","[Supplier Alpha Number]= '" & Forms![frmComplianceFailureDataEntry]![Supplier Number] & "'")
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 12:49
Joined
Sep 12, 2006
Messages
15,658
is [supplier alpha number] (and therefore [supplier number]) really a number, or is it a string? That will also affect the dlookup syntax as well
 

murray83

Games Collector
Local time
Today, 12:49
Joined
Mar 31, 2017
Messages
729
it be a string

I tried the first one and now I have a flashing #error

the second one says #name
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:49
Joined
May 7, 2009
Messages
19,245
bring the form, frmComplianceFailureDataEntry, in Design view and check the textbox Name.
substitute the textbox name to "Supplier Number" on the second code i gave.
 

murray83

Games Collector
Local time
Today, 12:49
Joined
Mar 31, 2017
Messages
729
huh,

what do you mean check and substitute, if your asking if they are spelled the same then yes they are
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:49
Joined
May 7, 2009
Messages
19,245
is it a textbox/combobox or Label ?
 

murray83

Games Collector
Local time
Today, 12:49
Joined
Mar 31, 2017
Messages
729
cheers the code did work it was my fault, bangs head.

was trying it on a copy of the form and hence the name for the form wasn't the same :)

cheers all
 

Users who are viewing this thread

Top Bottom