DLookup Date Syntax

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

Guest

Need help with the correct syntax for Dlookup with date and numeric criteria.

Results = DLookup([CompanyName], "tblIssuePermits",
"[PermitExpireDate]=#09/30/2006# And [CustomerNo]=stCustomerNo")

CustomerNo field is an autonumber.
 
Concatenate the value into the 3rd string:

Results = DLookup("CompanyName", "tblIssuePermits", _
"[PermitExpireDate]=#09/30/2006# And [CustomerNo] = " & stCustomerNo)

For an explanation, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html
 
Thank you,

I works prefectly.

Allen Browne said:
Concatenate the value into the 3rd string:

Results = DLookup("CompanyName", "tblIssuePermits", _
"[PermitExpireDate]=#09/30/2006# And [CustomerNo] = " & stCustomerNo)

For an explanation, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

iholder said:
Need help with the correct syntax for Dlookup with date and numeric
criteria.

Results = DLookup([CompanyName], "tblIssuePermits",
"[PermitExpireDate]=#09/30/2006# And [CustomerNo]=stCustomerNo")

CustomerNo field is an autonumber.
 
I need some help with trapping the Null retrun.

If DLookup() does not return a value. The current return is "Invalid use of
NUll."


iholder said:
Thank you,

I works prefectly.

Allen Browne said:
Concatenate the value into the 3rd string:

Results = DLookup("CompanyName", "tblIssuePermits", _
"[PermitExpireDate]=#09/30/2006# And [CustomerNo] = " & stCustomerNo)

For an explanation, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

iholder said:
Need help with the correct syntax for Dlookup with date and numeric
criteria.

Results = DLookup([CompanyName], "tblIssuePermits",
"[PermitExpireDate]=#09/30/2006# And [CustomerNo]=stCustomerNo")

CustomerNo field is an autonumber.
 
Use the Nz function to convert a Null value into a value of your choice, for
example, an empty string:

Results = Nz(DLookup("CompanyName", "tblIssuePermits", _
"[PermitExpireDate]=#09/30/2006# And [CustomerNo] = " & stCustomerNo), "")

--

Ken Snell
<MS ACCESS MVP>

iholder said:
I need some help with trapping the Null retrun.

If DLookup() does not return a value. The current return is "Invalid use
of
NUll."


iholder said:
Thank you,

I works prefectly.

Allen Browne said:
Concatenate the value into the 3rd string:

Results = DLookup("CompanyName", "tblIssuePermits", _
"[PermitExpireDate]=#09/30/2006# And [CustomerNo] = " & stCustomerNo)

For an explanation, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Need help with the correct syntax for Dlookup with date and numeric
criteria.

Results = DLookup([CompanyName], "tblIssuePermits",
"[PermitExpireDate]=#09/30/2006# And [CustomerNo]=stCustomerNo")

CustomerNo field is an autonumber.
 
Back
Top