find the correct cost to corresponding weight

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

Guest

win xp and access 2003
I have a table postageTbl that has two fields, "maxweight" and
"PostageCost". I have a form with inventory records (attached to
InventoryTbl). The form has two fields, "weight" and "estimatedPostage".

I need to be able to scan (loop) through all of the maxweight amounts until
the weight in the "weight" field on the form is in the right category and
then import the corresponding cost into the "estimatedPostage" field on the
form.

How can this be done?
 
BLTibbs said:
win xp and access 2003
I have a table postageTbl that has two fields, "maxweight" and
"PostageCost". I have a form with inventory records (attached to
InventoryTbl). The form has two fields, "weight" and "estimatedPostage".

I need to be able to scan (loop) through all of the maxweight amounts until
the weight in the "weight" field on the form is in the right category and
then import the corresponding cost into the "estimatedPostage" field on the
form.


Let Access do the looping:

strSQL = "SELECT TOP 1 PostageCost " & _
"FROM postageTbl " & _
"WHERE maxweight >= " & Me.weight & _
" ORDER BY maxweight ASC"
Me.estimatedPostage = _
DbEngine(0)(0).OpenRecordset(strSQL).Fields(0)
 
Back
Top