Dlookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can't understand why this isn't working,..

I am trying to use the Dlookup function to enter data into a couple text boxes in a report but I can't seem to make it work.

I have a variable that return a project number (for example: 09789) - this works

I would like Dlookup to check this number and return the name of the project form the project number info table....as such, my code looks like this:

ProjNum = InputBox("Generate an EPS Report for which project number?", "Project Number?")
ProjName=DLookup("[Project Name]", "Project Number Info", "[Project Number]=" & ProjNum)

When I run my report I keep getting a data type mismatch in criteria expression (run time error # 3464)

Any ideas???
 
Daniel said:
I can't understand why this isn't working,..

I am trying to use the Dlookup function to enter data into a couple text boxes in a report but I can't seem to make it work.

I have a variable that return a project number (for example: 09789) - this works

I would like Dlookup to check this number and return the name of the project form the project number info table....as such, my code looks like this:

ProjNum = InputBox("Generate an EPS Report for which project number?", "Project Number?")
ProjName=DLookup("[Project Name]", "Project Number Info", "[Project Number]=" & ProjNum)

When I run my report I keep getting a data type mismatch in criteria expression (run time error # 3464)

It sound like the [Project Number] field is a Text field.
If so, then the value in the DLookup needs to be enclosed in
quotes. Either:

. . . , "[Project Number]=""" & ProjNum & """")
or
. . . , "[Project Number]='" & ProjNum & "'")
 
I can't understand why this isn't working,..

I am trying to use the Dlookup function to enter data into a couple text boxes in a report but I can't seem to make it work.

I have a variable that return a project number (for example: 09789) - this works

I would like Dlookup to check this number and return the name of the project form the project number info table....as such, my code looks like this:

ProjNum = InputBox("Generate an EPS Report for which project number?", "Project Number?")
ProjName=DLookup("[Project Name]", "Project Number Info", "[Project Number]=" & ProjNum)

When I run my report I keep getting a data type mismatch in criteria expression (run time error # 3464)

Any ideas???

It appears that your project "number" is actually a text value. If
that is the case then you need to enclose you supplied value with
single or double quotes.

ProjName=DLookup("[Project Name]", "Project Number Info", "[Project
Number]='" & ProjNum & "'")


- Jim
 
Back
Top