Results 1 to 2 of 2
  1. #1
    kbsudhir is offline Novice
    Windows Vista Access 2003
    Join Date
    Apr 2009
    Posts
    10

    Question Set Default Date in Datetimepicker using a query

    Hi All,



    I am trying to set default date in the DateTimePicker using VBA in access 2007. But I am getting the below error:

    Code:
    Run-time error '2763'
    DTPicker returned the errorAn error occurred in a call to the Windows Date and Time Picker control 

    I am able to get the date sucessfully using the query. But not able to pass the same to the DTPicker. I have tried below codes but with same error.

    Code:
    
    TxtBox_Date.Value = rst!Event_Date 
    DTPicker_EventDate.Value = TxtBox_Date 
    
    and
    Code:
    
    DTPicker_EventDate.Value = TxtBox_Date.Text 
    
    and
    Code:
    
    DTPicker_EventDate.Value = TxtBox_Date.value 
    
    and
    Code:
    
    DTPicker_EventDate.Value = rst!Event_Date 
    
    I am using Access 2007 on Windows 7 Professional.
    Please guide me on where am I going wrong and what should I do get this fixed.

    Thanks for all your time and help.

    Regards
    Sudhir

  2. #2
    kbsudhir is offline Novice
    Windows Vista Access 2003
    Join Date
    Apr 2009
    Posts
    10
    Its done guys.


    The right code is:
    Code:
    DTPicker_EventDate.Value = rst!Event_Date
    I was getting that error because my DTP was set in Visible = No mode as I was changing the mode after setting the default date. Now I changed it to visible before setting its default date.


    Regards
    Sudhir

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using a Default Date that can be altered.
    By bundymick in forum Access
    Replies: 3
    Last Post: 02-11-2014, 07:56 AM
  2. Name & Date by Default
    By smarty84handsome in forum Reports
    Replies: 12
    Last Post: 01-21-2012, 12:22 AM
  3. Replies: 10
    Last Post: 11-06-2011, 01:30 PM
  4. Default date value
    By Wayne311 in forum Database Design
    Replies: 4
    Last Post: 01-15-2011, 05:38 PM
  5. Default Date in Date Fields
    By rickn in forum Access
    Replies: 5
    Last Post: 04-14-2010, 01:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums