Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSComCtl.DTPicker on an Access form

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a MSComCtl.DTPicker on an Access form.
The control source is set to a date field (data type Date/Time).
In the properties I have the value set to the date.
I get an error message: "Can't set value to NULL when CheckBox property
= FALSE." when adding a new record. Any ideas??
 
I ran into the same problem with a VB app. If you don't always want a date to be used, you can turn on the checkbox property. If you don't want the checkbox and always expect a date to be entered, this is what I did:

To work around it I used the control without binding it to a field. When moving to an existing record I set its value to the appropriate value contained in the database. When moving to a new record, I set its value to the current date (using now() or some other function that returns the current date). When a record is updated (new or existing record), I grabbed the value out of the unbound control and put it in the appropriate field of the recordset (I think, in my case, I used the WillChangeRecord event). I think you can do all of this in Access, of course the events, etc. may be different.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top