Full Version: DT PICKER
UtterAccess Forums > Microsoft® Access > Access Date + Time
I have inserted a Date and Time Picker from the Active X controls on to my form.
On the DT Picker properties i have chosen a checkbox to signify if the date has been selected.
The problem:
When opening the form straight to a new record the default date is set to todays date, which is great. However if you scroll through the completed records in my database and then try and go to a new record, the default date will then no longer be todays date but will contain a date which was inputted in a previous record.
Unfortunately i dont seem to be able to set a default date() to the new record without making that date active.
Can anyone please advise.
Unbound control with Date() - TodaysDate
Bound control with date picker - DatePick
PK_ID being your auto number.
The in the on current of the form.
If [PK_ID] < 0 then
Me.DatePick = Me.TodaysDate.
So, when the form goes to a new record, the autonumber is null and the todays date will populate to your control.
Probably other ways to do this, but this will work for what you have I think.
Hi Jim,
Is there is no ID held within a new record the < 0 evaluation does not work.
Oalso tested by checking where ID is Null which see's the record as null, but creates a new record. I dont want to create a new record at this point but want the control to display at the current date with the checkbox unchecked.
If IsNull(Me.AcademicID) Then
Me.DTPicker3 = Me.TodaysDate
End If
Please Advise
Hi Badger.
You are right, my code is about a new record. (just add the id to the form and hide it would have been my answer)
However, if you use unbound controls with todays date, and then, in the event of the check box, or something that triggers the date to be copied, thenuse the Me. code to take the date in the unbound control into the bound date picker control.
Not sure if this helps but ....
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.