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

Lookups 2

Status
Not open for further replies.

vk

MIS
Mar 29, 2001
2
GB
I have a lookup table which displays costs for packages weighing 2, 4, 6 etc kg.

I have a package wiehing 5 kg - how can I force the lookup to put the value for 6 kg in the field?
 
Have the lookup refer to a query that uses this funciton

TryThis: Switch([Number]<=2,2,[Number]<=4,4,[Number]<=6,6)
Obviously you'll need to add more numbers to this list

Hope this helps,
 
Hi Vk,
A couple of assumptions here: you're entering the weight in to one field and you want the value placed in to another:

In the after update event of your weight field in Visual Basic (Form design, double-click on your weight field to open up its properties dialog, select the Event tab, find After update, select &quot;event procedure&quot;, then click &quot;...&quot; beside to open VB and label up a &quot;sub&quot;) add this:

Me![NameOfYourPriceField]= DLookup(&quot;TheNameofPriceFieldIn&quot;, &quot;TheTableWherePriceFieldLives&quot;, &quot;WeightFieldInThatTable >= &quot; & Me![WeightEntryFieldOnForm])

Be very careful with the punctuation and spacing. Close and save and see if it flys...!
Gord
ghubbell@total.net
 
Thanks for yuor help - I'll give it a whirl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top