Dlookup

spg2112

Active Member
Joined
Feb 27, 2002
Messages
316
Hey all,

What's wrong with this control source code? I was wanting the text box to return the "Balance" from a table called "081304s", based on the value in the Customer Number field, from my form's main table. This is driving me nuts! HELP!!

Conum = the table where "Balance" is;
Credit = the form name

Dlookup("[Balance]", "081304s", "[CoNum] = & Forms! [Credit]! Customer Number")
 
try:-
Dlookup("[Balance]", "081304s", "[CoNum] = " & Forms! [Credit]! Customer Number)

Peter
 
Upvote 0
I get an Invalid Syntax error with that. The example in access for Dlookup is confusing. In the "where" statement [ProductID] is the same name as the field from the source table?? Any other takers?

Steve
 
Upvote 0
If the "Customer Number" is text rather than a number then you will need to wrap it in quotes

Dlookup("[Balance]", "081304s", "[CoNum] = '" & Forms! [Credit]! Customer Number & "'")

thats single and double qoutes, here is is again spaced out for clarity.

= ' " & Forms! [Credit]! Customer Number & " ' ")


HTH

Peter

ps. you may need to wrap Customer Number in Square Brackets as well because of the space.

Dlookup("[Balance]", "081304s", "[CoNum] = '" & Forms! [Credit]![Customer Number] & "'")
 
Upvote 0
Did you spot my edit about Square Brackets?
Dlookup("[Balance]", "081304s", "[CoNum] = '" & Forms! [Credit]![Customer Number] & "'")

Peter
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top