DLookUp With Date Criteria Error

Nadine67

Board Regular
Joined
May 27, 2015
Messages
225
Hello and thank you for any attention my post may receive.

On my userform I have three fields – cboUID, txtComm andtxtID.

  1. cboUID - number field.
  2. txtComm - date field with Control Source ‘=DateValue(DMin("[Date_Commissioned]","qryUnit","[Unit]=" & [cboUID]))’.
  3. txtID – Control Source is ‘=CSng(DLookUp("ID","tblUnit","[Unit]=" & [cboUID] & " And [Date_Commissioned]=#" & [txtComm] & "#"))’.

txtComm is not visible because it is purely a ‘helper’field.
txtID is not visible because it is also a helper field thatis used to open another form to the correct record.

I select a number in cboUID, txtComm populates with thecorrect date value, however txtID returns #Error…..and I have no idea why!



Any advice would be greatly appreciated!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,589
Messages
6,173,231
Members
452,505
Latest member
Neeraj1990

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