Dlookup Syntax Help

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

Guest

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID]"=[Forms]![frmOrderInfo]![DV_Code])

I don't get an error but I don't get my data either. Probablly a " or , or
() or something else along that lines but I'm not seeing it.

Any help would be appreciated.

Thanks in advance for any assistance.
 
Hi cvegas,

Try it this way

=DLookUp("[AccountName]", "[dbo_tblAccounts]", "[AccountID] = " &
[Forms]![frmOrderInfo]![DV_Code])

HTH
Steve C
 
Hi Steve.

I copy & pasted your code and got nothing to display. Relaized that the
last part was not looking at the proper field so changed the code to the
following

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = " &
[Forms]![frmOrderInfo]![ConvDeliveryVendor])

Now I get an #Error message in the txtbox.

I pretty confident that all fields are text fields in the underlying tables.
Any ideas?

Thanks again for your assistance.

Chuck

Steve Conway said:
Hi cvegas,

Try it this way

=DLookUp("[AccountName]", "[dbo_tblAccounts]", "[AccountID] = " &
[Forms]![frmOrderInfo]![DV_Code])

HTH
Steve C

cvegas said:
=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID]"=[Forms]![frmOrderInfo]![DV_Code])

I don't get an error but I don't get my data either. Probablly a " or ,
or
() or something else along that lines but I'm not seeing it.

Any help would be appreciated.

Thanks in advance for any assistance.
 
Hi cvegas,

Is AccountId a text data type? If so change to this

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = '" &
[Forms]![frmOrderInfo]![ConvDeliveryVendor] & "'")

after the = it's single quote double quote and after the last & it's
double-single-double

HTH
Steve C

cvegas said:
Hi Steve.

I copy & pasted your code and got nothing to display. Relaized that the
last part was not looking at the proper field so changed the code to the
following

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = " &
[Forms]![frmOrderInfo]![ConvDeliveryVendor])

Now I get an #Error message in the txtbox.

I pretty confident that all fields are text fields in the underlying
tables.
Any ideas?

Thanks again for your assistance.

Chuck

Steve Conway said:
Hi cvegas,

Try it this way

=DLookUp("[AccountName]", "[dbo_tblAccounts]", "[AccountID] = " &
[Forms]![frmOrderInfo]![DV_Code])

HTH
Steve C

cvegas said:
=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID]"=[Forms]![frmOrderInfo]![DV_Code])

I don't get an error but I don't get my data either. Probablly a " or
,
or
() or something else along that lines but I'm not seeing it.

Any help would be appreciated.

Thanks in advance for any assistance.
 
If AccountID is text then you need a couple of additional single speech
marks....

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = '" &
[Forms]![frmOrderInfo]![ConvDeliveryVendor])&"'")

....the finished criteria string should look like [AccountID]='sdfsd'



cvegas said:
Hi Steve.

I copy & pasted your code and got nothing to display. Relaized that the
last part was not looking at the proper field so changed the code to the
following

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = " &
[Forms]![frmOrderInfo]![ConvDeliveryVendor])

Now I get an #Error message in the txtbox.

I pretty confident that all fields are text fields in the underlying tables.
Any ideas?

Thanks again for your assistance.

Chuck

Steve Conway said:
Hi cvegas,

Try it this way

=DLookUp("[AccountName]", "[dbo_tblAccounts]", "[AccountID] = " &
[Forms]![frmOrderInfo]![DV_Code])

HTH
Steve C

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID]"=[Forms]![frmOrder
Info]![DV_Code])
 
Hi Steve.

I copy & pasted your code and got nothing to display. Relaized that the
last part was not looking at the proper field so changed the code to the
following

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = " &
[Forms]![frmOrderInfo]![ConvDeliveryVendor])

Now I get an #Error message in the txtbox.

I pretty confident that all fields are text fields in the underlying tables.
Any ideas?

PMFJI - if AccountID is a Text field (and the value in the table
matches the value in ConvDeliveryVendor) you'll need syntactically
required quote marks:

=DLookUp("[AccountName]","[dbo_tblAccounts]","[AccountID] = '" &
[Forms]![frmOrderInfo]![ConvDeliveryVendor] & "'")


John W. Vinson[MVP]
 
Back
Top