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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup in text box 1

Status
Not open for further replies.

dtutton

Technical User
Mar 28, 2001
58
DE
I have a Dlookup expression as follows:

=DLookUp("Price","TyreQuotes","DATNo=" & [Forms]![EquipmentData]![TyreDATNo])

in the Control Source of a text box where "Tyre Quotes" is a query, "Price" and "DATNo" are fields in the Query and "TyreDATNo" is the name of a textbox in the EqupmentData form.

All I get is a flickering "#error" showing in the box. It appears to be in a loop !!

Any help would be appreciated.

David
 
Hi David,
Maybe:

=DLookUp("Price","TheTableWhereThePriceFieldIs","DATNo = " & [Forms]![EquipmentData]![TyreDATNo])

Should work going to the table for the price instead. :) Gord
ghubbell@total.net
 
Try this:
=DLookUp("[Price]","TyreQuotes","[DATNo]=" & TyreDATNo)

Sometimes you have to play around with the syntax...I wish dlookup were a simpler function to use. Good luck.
 
Gord,

I have to go the query route because the table has multiple prices for the same DATNo (i.e. various quotes) while the query only has one unique value for each DATNo.

If Dlookup could select based on two fields it would be OK

Thanks anyhow

David
 
Tried =DLookUp("[Price]","TyreQuotes","[DATNo]=" & TyreDATNo) but same flickering error.

Is there any debug method for a field on a form ? or is it real trial and error.

Also any alternate approached of getting the data ?
 
David, what's the other criteria that's required if we go to the table? Is it available on your form? I don't think you can get this to go on a query that's grouping stuff with out this problem... Gord
ghubbell@total.net
 
Gord,

I guess if I were refering to the table I'd want something like:

in table tyrequotes, locate price for DATNo=TyreDATNo and Year>=1999 and Country=USA

where price, year, country and DATNo are all fields in table tyrequotes and TyreDATNo is a value in another table refered to on the form in a label with the same name.

I somehow thought the query route was the soln.

Hope Im not confusing things, I used to program alot in clipper and am a spreadsheet user who is just starting into access - starting being the key word!

Thanks for your help

David
 
Hope I'm not confusing things! Is the criteria >=1999 and USA always the same on this form? Gord
ghubbell@total.net
 
Gord,

Ill keep it simple as Im the sole user - YES

David
 
I'm still going here! I think one last question (sorry)...If you looked in the table would this give you a single price or could there be lots of prices based on this criteria? Gord
ghubbell@total.net
 
Gord,

It would be a single price with:

in table tyrequotes, locate price for DATNo=TyreDATNo and Year>=1999 and Country=USA

David
 
Gord,

Your comment in the other thread "its in the brackets' was the solution:

=DLookUp("price","TyreQuotes","DATNo='" & [TyreDAT] & "'")
refering to the query but the condition value in single quotes.

Thanks for your help

David

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top