Date Time Picker

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I'm update a form someone else created. I added a
DateTimePicker control to the form and I want it to
default to the current date everytime someone loads the
form. I've tried using DTPicker1.value = Date in the form
load event and I get the error:

Run-tim error '2763':
DTPicker returned the error: An error occurred in a call
to the Windows Date and Time Picker control..

Also if I try and set the MinDate and MaxDate values in
code I always get an error message saying that the date is
in the incorrect format. I've tried every date format I
can think of without any success.

On one of the forms I created from scratch I am able to
set the DateTimePicker control value in the form load event
and set the MinDate and MaxDate values
 
Try

DTPicker1.value = Now()

And I am not sure but you may have to put this code in the FormOpen event.


Hope this helps
Gene
 
Thanks for the reply Gene

I have tried using,

DTPicker1.Value = Now()
DTPicker1.Value = DateTime.Now()
DTPicker1.Value = "06/03/2003"

And every other way I can think of to input a date. It
doesn't want to accept anything. I'm wondering if it
might be a reference problem. I made sure that I put the
code in the FormLoad event. I've been working on this
problem on the side for a week now and I'm all out of
ideas.

Dave
 
Hi,
Just for the heck of it,
put:
DTPicker1.SetFocus
DTPicker1.Value = Now()
See if that changes anything.
 
Thanks Dan,

I now understand why I doesn't set the value. The Date
Time Picker is located on the last Tab on a Tab control.
However the problem now is how do I set it's value to the
current date in it's present location?

Dave
 
enable the checkbox under the properties then type

DTPicker1.Value = Now
DTPicker1.Value = NULL
 
Stoopid Datetime Picker

I'm sure you have already figured this out, but for anyone else who is stuck:

Dim intSelectedTab As Integer

intSelectedTab = tabMain.Value 'Store the current tab

tabMain.Value = 2 'Or whatever the tab you want is
DTPickerEnquiry.SetFocus
DTPickerEnquiry.Value = Now() 'Or whatever date you want
tabMain.Value = intSelectedTab 'Go back to original tab

That was for Excel, but I'm sure Access is similar ;)


Dave said:
Thanks Dan,

I now understand why I doesn't set the value. The Date
Time Picker is located on the last Tab on a Tab control.
However the problem now is how do I set it's value to the
current date in it's present location?

Dave
 
Hi!
I got problem with my 2 dtPicker that were on a tab.
Tried what you said but didn't work.

I think I found with the sendkeys "{ESC}" command.

without setfocus, all screen was locked after the update of one of my dtPicker.
with setfocus, it worked the first time but then, the dtPicker was to null, I couldn't pus the focus in it again!

lost 2 days... thanks to Microsoft to not gave access to access97 dtPicker stuff!
 
dTPicker in Access 2003

Hi!
I have been struggling with this error for a while and finally today I found a solution:

1 Create a textbox ( txtDatDummy ) somwhere on the form, set Format to Long date or Short date. Set Visible=False
2 On form Load:
- Set the textbox to desired date e.g.Date or dateadd("d",14, Date)
- Set dtpicker = textbox

Example:

Me.txtDatDummy = Date
Me.dtpSelectDate.SetFocus
Me.dtpSelectDate = Me.txtDatDummy

You're done.

Best regards!
 
Back
Top