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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,225,399
Messages
6,184,746
Members
453,254
Latest member
topeb

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