Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could someone help with a quick dlookup problem?

Status
Not open for further replies.
Apr 25, 2002
69
US
DLookUp("[user_defined_field]","sqluser_user_def_fields_MS"," [account_number] = form![member_acct_no] & [sequence_no] = 10")

I'm trying to do a lookup of a user_defined_field in a table that has the same account number as entered on my form and a sequence number of 10. Can someone help me with the syntax? If I remove the sequence number part of the equation, I get the user_defined_field of the first record, so I think my statement works up to that point. I just can't figure out how to incorporate the sequence number. Many thanks.
 
Try:
DLookUp("[user_defined_field]","sqluser_user_def_fields_MS"," [account_number] = form![member_acct_no] AND [sequence_no] = 10")



Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks, but I still can't get it to work. It returns a value if I ask for either/or piece of information (member_acct_no or sequence_no), but not both.
 
Wait a second. form![member_acct_no] references only a form and not a control. What's up with that?

If Account_Number is numeric and your form name is frmName, try:
DLookUp("[user_defined_field]","sqluser_user_def_fields_MS"," [account_number] = " & form!frmName![member_acct_no] & " AND [sequence_no] = 10")

If it is text try:
DLookUp("[user_defined_field]","sqluser_user_def_fields_MS"," [account_number] = """ & form!frmName![member_acct_no] & """ AND [sequence_no] = 10")




Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top