Dlookup Date Format Issue

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
Hi there, I am having difficulty with a DLookup. I want to look at the date in one table, and return a value from another table based on said date. This is what I have so far:

Code:
Leaving Date: DLookUp("DateMatrix_Date","tblMatrix_DateMatrix","DateMatrix_Date = #" & [SDB_EndDate] & "#")

Problem is that although the fields in both tables are the same, If the lookup value is "03/09/2010" the Dlookup is returning the value for "09/03/2010" first.

How can I fix this?

Andy
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Convert the date to a long integer. That makes it unambiguous.
Code:
Leaving Date: DLookUp("DateMatrix_Date","tblMatrix_DateMatrix","DateMatrix_Date = " & CLng([SDB_EndDate]))

Denis
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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