Solved Dlookup with spaces in column names

murray83

Games Collector
Local time
Today, 07:11
Joined
Mar 31, 2017
Messages
827
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
 
Code:
=DLookUp("[Supplier Name]","tblSupplierDetails","[Supplier Alpha Number]= Forms![frmComplianceFailureDataEntry]![Supplier Number]")

=DLookUp("[Supplier Name]","tblSupplierDetails","[Supplier Alpha Number]= '" & Forms![frmComplianceFailureDataEntry]![Supplier Number] & "'")
 
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
 
it be a string

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

the second one says #name
 
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.
 
huh,

what do you mean check and substitute, if your asking if they are spelled the same then yes they are
 
is it a textbox/combobox or Label ?
 
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

Back
Top Bottom