TblUni020 = Dlookup(" TbluniID199 ","xAllTablesunion","FieldName199=’" & TradingName020 *& "’
Both the fields FieldName199 and TradingName202 are strings, or words. What is wrong here?
TblUni020 = Dlookup(" TbluniID199 ","xAllTablesunion","FieldName199=’" & TradingName020 *& "’
Both the fields FieldName199 and TradingName202 are strings, or words. What is wrong here?
1 you have spaces either end of the field name you are looking up
2 the single quotes look the wrong type of quote (but that might be the font)
3 you have a surplus *
4 you are missing a ") at the end
5 you say you are using TradingName202 but are actually using TradingName020
you have now dropped the " before the last '
No, not on nightshift - I'm in the UK so about the same time as you
why not just bring the xAllTablesunion into your query and join on FieldName199 and TradingName020
My query "q01BusinessInfo" becomes not write able, linking those two fields. In the table xAllTablesunion it would have worked if I made Fieldname199 the primary key, but sometimes I need the same name to appear in that field, so it can not be the primary key. I set up a query of xAllTablesunion and filter that only records normally in q01BusinessInfo will be listed, by this time I believe I need the expression. So the latest, I added what you say but. TblUni020: DLookUp("TbluniID199","xAllTablesunion","FieldName 199='" & [TradingName020] &"'")
![]()
you now have a space in FieldName199
if there is supposed to be a space, you also need to use square brackets - [FieldName 199]
I have to do this link in about 150 of our 800 queries. q01BusinessInfo holds one record for it is the business for whom the books is held, but all other queries may have many records, and it is a bit of a long story for what I need it, I will spare you that. I learnt programming since 5 years ago, and have a list of many kinds of expressions, and more than 500 clips of downloads, but I still fall short knowing how to compare two words in the criteria part.
Last week there was another thread that this happened to. Even when I clicked on "Edit" here on the forum the space disappeared. When I copied it here there was no space? But it works now, thank you.
to preserve text formatting of code (SQL or VBA) you need to use the code tags.