Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2001
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having trouble setting the value of a DTPicker (AccessXP)

    Greetings, exalted gurus.

    I have just now discovered the DTPicker control, and immediately set to work putting it into an application. I have hit a stumbling block setting the initial value of the control.

    I have two unbound DTPicker controls on a form, so a user can select start and end dates for a report. They are called ocxDTPickerFrom and ocxDTPickerTo. I would like the ocxDTPickerFrom to default to roughly 1 month prior to today, and put the following line in the OnOpen event of the form:

    Me.ocxDTPickerFrom.Value = now() -30

    When I open the form, I get the following error:

    Run-time error '2763':
    DTPicker returned the error: Property is read-only

    I searched the lounge, but couldn't find anything relating specifically to this problem. I've also read all of the documentation I could find on the MS website to no avail.

    I only have the professional edition of Office XP, so I'm not sure if this control comes with XP, or whether it was installed with Visual Studio 6 and is not compatible with XP.

    The control is listed as MSComCtl2.DTPicker.2

    Any help would be appreciated.

    Regards,
    JP

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Having trouble setting the value of a DTPicker (AccessXP)

    Office XP is based on VB6, same as Office 2000, so the control should be the same. Where are you trying to set the value? I've been successful setting it in the form's Load event and also in the DropDown event of the DTPicker. Also try changing your formula to this:

    Me.ocxDTPickerFrom.Value = Date() - 30

    Does that make a difference?
    Charlotte

  3. #3
    New Lounger
    Join Date
    Feb 2001
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Having trouble setting the value of a DTPicker (AccessXP)

    Hi Charlotte, thanks for the reply.

    I was trying to set the value in the forms Open event, but have tried to do it in the Load event of the form with no luck. In the properties list for the control, there is no DropDown event listed, which again leads me to think that I have an incompatible version of the control.

    Is the control available for download from anywhere, so that I might check it against the copy I have?

    As an aside, what is the benefit of using Date() over Now()?

    Thanks in advance

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Having trouble setting the value of a DTPicker (AccessXP)

    Are you using a third-party datetime picker? I use the Microsoft Date and Time Picker Control 6.0 (SP4). Are you using the same one? Do you have a reference set to the mscomct2.dll library (Windows Common Controls-2 6.0 (SP4))? You need the reference set before you can really use the control.
    Charlotte

Posting Permissions

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