Results 1 to 5 of 5
  1. #1
    Join Date
    May 2003
    Posts
    3

    Unanswered: DTPicker read-only in Access?

    Hello.

    I'm trying to drop a standard Comctl2 DTPicker on a form in MS Access XP. Everything works perfectly, except the annoying fact that it won't let me change the default date displayed in the control.

    I can change it to design time, but I'd rather have it show Now() whenever someone opens the form.

    The control is not linked to any table, form or query, but the value is used during a button click event.

    I'm trying to set the control like this:

    Code:
    Private Sub Form_Open(Cancel as Integer)
    
          Me.dtpPicker.Value = Now()
    
    End Sub
    When I load the form, it tells me that this value is read only. What am I doing wrong? Is there a way around this?

    Thanks.

    -Jimmy

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    Re: DTPicker read-only in Access?

    Originally posted by Jim Morrison
    Hello.

    I'm trying to drop a standard Comctl2 DTPicker on a form in MS Access XP. Everything works perfectly, except the annoying fact that it won't let me change the default date displayed in the control.

    I can change it to design time, but I'd rather have it show Now() whenever someone opens the form.

    The control is not linked to any table, form or query, but the value is used during a button click event.

    I'm trying to set the control like this:

    Code:
    Private Sub Form_Open(Cancel as Integer)
    
          Me.dtpPicker.Value = Now()
    
    End Sub
    When I load the form, it tells me that this value is read only. What am I doing wrong? Is there a way around this?

    Thanks.

    -Jimmy
    Jimmy, put it in Form_Load event

    hope this helps
    qha_vn

  3. #3
    Join Date
    May 2003
    Posts
    3

    Unhappy I hate stupid bugs...

    Ok... get a load of this...

    I tried your suggesstion and am getting a Run-Time error 2763.

    I messed with it a bit with a new database, and it worked fine. After tinkering, I discovered the following:

    An error is returned if the DTPicker is on a non-topmost tab in a tab control!!

    Try it. Make blank form. Drag a DTPicker on it, and put a Me.DTPicker0.Value = Now() statement in the Form_Load event.

    No problem.

    Make a tab control, put the DTPicker on the top-most tab.

    No problem.

    Put the DTPicker on the next tab down.

    Error code.

    Man, I'm getting sick of Microsoft's buggy as hell controls! It seems I'm finding this kinda stuff every other week! Somehow I manage to discover the 1 instance in 100 where the stupid control fails to do what's expected!

    If anyone can help me out of this pickle, I'd be grateful, but if not, thanks for trying.

    -Jimmy

  4. #4
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    thx

    thanks for the sharing, i even didnt know about that stupid tab focus error. and thats not all, if you try ms calendar control, you may get mad
    qha_vn

  5. #5
    Join Date
    May 2003
    Posts
    3
    Huh, I just tried it and it actually seems to work fine... (Calander Control v10.0). Now if it was only small enough to be useful in anything except large scheduling forms.

    I've kinda banned that control after trying to use it in a VB6 project a few years back and the standard VB Packaging and Deployment wizard couldn't handle the distribution of it; it kept crashing.

    Well, I solved my problem with the following code:

    Code:
    Private Sub Form_Load()
         Me.TabCtl1.Value = 1
         Me.DTPicker0.Value = Now()
         Me.TabCtl1.Value = 0
    
    End Sub
    Thanks for your help!

    -Jimmy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •