I am trying to look up a selected record in a table.
The table holds Company names and a field to identify Report Paths.
This table called tblServerReportTable has three fields ServerID, Company and ReportPath.
I want to look up the 'report path' based on selecting a specific company.
In my code, I have a variable called MyCompany which identifies the company.
However my Dlookup code, to look up this report path, fails.
The code I am trying to use is;
MyLookup = DLookup("[ReportPath]", "tblServerReportTable", "[company] =" & [MyCompany])
The code is failing with the error
"Syntax error (missing operator) in query expression '[company]=MyCompanyName'
(MyCompanyName is the return of the variable MyCompany.)
I have tried many different quotes formats, etc without success.
Can anyone help with what is wrong with my code, or is there a better way, for example a SQL select code ?