Date Time Picker

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
 
G

Gene

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
 
D

Dave

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
 
D

Dan Artuso

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

Dave

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
 
Joined
Jan 14, 2006
Messages
1
Reaction score
0
enable the checkbox under the properties then type

DTPicker1.Value = Now
DTPicker1.Value = NULL
 
Joined
Jul 13, 2005
Messages
24
Reaction score
0
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
 
Joined
May 11, 2010
Messages
1
Reaction score
0
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!
 
Joined
Oct 25, 2010
Messages
1
Reaction score
0
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top