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

DLookup two Conditions 1

Status
Not open for further replies.

Hulm1

Technical User
Mar 11, 2008
100
GB
I am trying to look up a rate which will be based on two conditions. Condition 1 is the ComponentID (in a combo box in a subform (continuous form) and Condition 2 is the RentalPriceBandID(in another combo box called "RentalPriceBandID" but this time in the Main Form.

I am trying to populate a bound text box "Rate" from the After Update event of the combo book on the subform which selects the component.

This is my code effort:

Private Sub ComponentID_AfterUpdate()
Me.Rate = DLookup("[RentalRate]", "zmtComponentRentRate", "[ComponentID]" And "[RentalPriceBandID]" = Me.ComponentID And Forms![Estimate]![RentalPriceBandID])
End Sub

Table zmtComponentRentRate has ComponentID, RentalRate and RentalPriceBandID.

Help most welcome
 
Me.Rate = DLookup("RentalRate", "zmtComponentRentRate", "ComponentID=" & Me!ComponentID & " And RentalPriceBandID=" & Forms!Estimate!RentalPriceBandID

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top