DLookUp with Multiple Criteria

Zempten

Board Regular
Joined
Apr 21, 2014
Messages
55
Hello

I am attempting to populate a textbox in my form with the DLookup function with multiple criteria. The purpose is to show how many appointments matches an appointment time, warehouse, product, and appointment day (hence the multiple criteria). The code I use is

txttime1.Value = DLookup(Master.APPT_TIME, Master, Master.APPT_TIME = Form_OrderUpdate.APPTTIME And Master.APPT_DATE = Form_OrderUpdate.APPTDATE And Master.WHSE = Form_OrderUpdate.WHSE And Master.BUISNESS = Form_OrderUpdate.BUISNESS)

Master is where the data is stored. However, when I run this it keeps telling me that Master is an undefined variable and it leaves me confused since its the name of my Table. Am I missing something here? Thanks for any help!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
The quotation marks was where I was missing. Thanks for pointing it out to me. I think I've been staring at code too long =/ Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top