Link to home
Start Free TrialLog in
Avatar of sgrice
sgrice

asked on

Can't set Value of DTPicker

I have tried setting the value of the DTpicker at runtime using the following statement in the Form_Load procedure:
           me.ctlDate.value = Now

I get the error message:  Runtime Error :'2763'  An error occurred in a call to the Windows Date and Time Picker Control

I have downloaded the latest version of the .ocx file and made sure it was registered correctly.  I have read all the other threads and most of them state that if you put the statement in the Load procedure and use the above syntax, it should work.  I don't understand why my control isn't working.

I am using this control on a switchboard and therefore do not want or have the ability to assign it's control source to a field in a table.  I thought about using a subform that has a date field that is defaulted to the current date and use it as the source but I have no way of linking the parent form to the subform.

Please help - I don't have time on this project to get hung up on this control!

Thanks!

I have since narrowed it down to having something to do with filtering the form at runtime.  When I comment out the code that filters the recordset and turn on filtering for the form, it works fine.  When I put it back - get the message again.
Avatar of sgrice
sgrice

ASKER

I have fixed the problem.  I tried just setting the record source at runtime and that didn't work until I changed the Record source property of the form to a SQL statement for the initial switchboard.  Something about the record source just being the underlying table then changing the recordset at runtime prompted the error message.  I'm clueless as to why but it's fixed now.  Hope this helps someone else.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial