Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

Dlookup syntax

Can someone tell me what is wrong with this onprint event code?

Me.txtCustName = DLookup("[CompanyName]", "tblCustomers", "[CustNum] = Me.txtCustNum)
0
SteveL13
Asked:
SteveL13
1 Solution
 
mbizupCommented:
Change the criteria to

"Custnum =" & me.custnum
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
If CustNum is a text field, your going to need:

 "Custnum = " & chr$(34) & me.custnum & chr$(34)

 The Chr$(34) gives you the quote character, so you end up with:

 Custnumb = "<some value>"

 Would be worth it to read:

http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html

 which discusses passing strings within a string.

HTH
Jim.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now