Problem with DLookup cutting off the last character of the criteria

Thirith

Board Regular
Joined
Jun 9, 2009
Messages
118
On my main form, I've got a date field that should update another field based on a range of dates. The field is called txtDateSubmissionPhase1 and it should look up information in the table tblStageLookup, which has these relevant columns: StageDescription and StageEndDate.

This is the DLookup code I'm using:
Code:
varTest = DLookup("[StageDescription]", "tblStageLookup", "[StageEndDate] <= # " & [txtDateSubmissionPhase1] & "#")

However, weirdly I keep getting an error - and in this error it looks like the final character (in this case the second #) is omitted from the criteria.

Can anyone here tell me why this is happening and how I can avoid it? It seems a pretty strange thing for the code to do, but I have to admit that I'm always a bit at a loss with respect to code that needs to be in string format.
 
I agree, it is strange, but you could spend days getting to the bottom of it. :confused:

Whenever I post for help, I copy and paste and then perhaps change any static data for privacy reasons? My typing is way to slow to do that. :)
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

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