Dlookup

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

Guest

I have a control on my form for "Size". I want to be able to lookup on
another table. The other table has a "minsize", a "maxsize", and a price. I
want to be able to say that whereever the "Size" falls into that range then
choose that price.
 
Make the control a dropdown list (cmbSize), looking up to the table with the
various sizes in it. Then in the after update, set the value for the price
field, something like:

dim strSize as String

strSize = Me.cmbSize

If strSize = "minsize" then
me.price = 25.00
Else
me.price = 50.00
end if
 
Secret Squirrel said:
I have a control on my form for "Size". I want to be able to lookup on
another table. The other table has a "minsize", a "maxsize", and a
price. I want to be able to say that whereever the "Size" falls into
that range then choose that price.

Something like:

Me!Price = _
DLookup("Price", "tblPrices", _
Me!Size & " Between MinSize And MaxSize")

That assumes that the Size field is numeric, and also that all relevant
records in tblPrices have both MinSize and MaxSize filled in -- no
open-ended size ranges.
 
Back
Top