Click to See Complete Forum and Search --> : [RESOLVED] [Access] Set DTP Value on Form_Open?
RobDog888
May 30th, 2006, 03:09 AM
Its late, I'm very tired, and I need this in order to continue on with a project that was due like last week. :(
I have a VB 6 DTP on an Access Form inside Access. I want to preset the date to the currents days date. Sounds like something very easy.
In the Form_Open event I get an error 2763 - DTPicker returned the error.
In the Form_Open event its a Read-Only error - Run-time error '2135'.
Arrrg! What am I missing other then sleep?
Ecniv
May 30th, 2006, 06:51 AM
Dunno - did you fix it? (********ic hammer? chainsaw?)
Is the control set to read only by default?
Possibly on the data tab needs opening?
Is DTP editable? - perhaps it is still setting itself up when you try to set it and it doesn't like it? Or is trying to edit the record immediately?
EDIT:
Cannot use the word elec tronic?
RobDog888
May 30th, 2006, 07:02 AM
No, havent figured it out yet. Did google searches too.
I placed a temp button on the form to try it at runtime after the form is completely loaded and open but noooo. it still has to give error. This should be a simple thing. :confused:
Ecniv
May 30th, 2006, 07:10 AM
DTP? Is this a control with VB? or Windows?
Just wondering if I can set up a test with it...
RobDog888
May 30th, 2006, 07:45 AM
Its the standard Date Time Picker control in Windows Common Controls 6 - 2 from VB 6. If you have the runtimes for VB 6 (which you can download if you dont have) then you can add the control to your toolbox in access and drop on a form.
Ecniv
May 30th, 2006, 08:57 AM
The computer here doesn't seem to let me get that :( So won't be able to help.
Can you set the DTP at any point after it is on the form?
Is it linked to a table field?
Is it a specific property (.value?) that needs to be set?
Sorry can't think of anything else other than doing it yourself (properly) to work right.
DKenny
May 30th, 2006, 11:40 AM
Rob
I just tried this in the _Load event and it seems to work fine.
Private Sub Form_Load()
Me.DTPicker0.Value = Now()
End Sub
RobDog888
May 30th, 2006, 06:12 PM
Still same error. :(
RobDog888
May 30th, 2006, 06:39 PM
:lol: I told you guys I was tired. After getting some sleep I figured it out.
It was because I have multiple conditions that will show or hide certain controls on the form. The DTP is one of them. The error occurs only when the DTP is hidden!
Thanks for the input guys. :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.