Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9

    ActiveX Control calendar (datepicker)


    I am in the process of developing an appointment database system for the hospital. The idea is to insert a calendar into my form and link each date to the database field. In other words, if a user clicks on the 1st of December, then the appointments for that date should be populated into the fields and display the appointments for the 1st of December. If the user clicks on the 2nd of December, then the appointment of December 2nd should display the patients that have appointments on December 2nd. I inserted an ActiveX control (datepicker) but I am having a trouble coding the calendar using VB. Would you please assist me in completing this task.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I personally wouldn't use an ActiveX control unless I had to. I've used form based solutions like this with success:

    http://allenbrowne.com/ser-51.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    Could you please post the codes you used and directions?

    Thanks for your help,

    Alpha

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't actually use that particular one. The site I got the one I use from has since closed down. Allen seems to have provided pretty good directions for use though. Have you tried it?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    Yes, I tried it. You see, what I would like to do is to click on a date then the appointments for that specific will be display in the form. Allen's calendar does not link the date into field and there is an error on its VB codes.

    Thanks

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What's the error? I just downloaded his file, followed the directions for importing it into an Access 2000 database. It worked exactly as it should, putting the selected date into the specified text box. You would have to tweak his code a little to get appointments to display, but the date part should work correctly.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    Could you help me in tweaking the codes to get the appointments to display if I click on a date. If I change the date on a calendar, then the appointments for that date should display and if there is no appointments for that date, then the fields should be blank.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Depends on how you've got it set up, and there are numerous ways to do it. Presuming it's a form or subform based on a query that uses that textbox in its criteria, one way would be to add this to the code behind the OK button on his calendar:

    Code:
    Private Sub cmdOk_Click()
      On Error Resume Next
      'Purpose:   Transfer the result back to the calling text box (if there is one), and close.
    
      If Me.cmdOk.Enabled Then
        If gtxtCalTarget = Me.txtDate Then
          'do nothing
        Else
          gtxtCalTarget = Me.txtDate
          Forms!YourFormName.Requery
        End If
      End If
      gtxtCalTarget.SetFocus
      DoCmd.Close acForm, Me.Name, acSaveNo
    End Sub
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    Here is the error I am getting (bEnabled = (gtxtCalTarget.Enabled) And (Not gtxtCalTarget.Locked). I tried several times linking the calendar dates to the database fields but until now no success.

    Thanks

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    How are you calling the calendar? It's expecting the name of a textbox, not the name of a database field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    Could I e-mail you the database? I inserted a textbox and tried to call it but it is just not happening. Thanks

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You should be able to post it here, after compacting and zipping.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    I was not able to attach the database, because I do not see the attachment option. I did a test DB where I imported the allen's callendar, then I inserted a textbox called textbox11. Now how do I code texbox11 to keep the date based on the day I select on the calendar?

    Thanks

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You have to go into Post Reply or Go Advanced to see the Manage Attachments button.

    The name of the textbox is the first argument when calling the calendar:

    =CalendarFor([textbox11], "Select the sale date")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    aakann is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    9
    I followed the instruction you have given me and its partially did I wanted. The textbox is showing the date I am selecting from the calendar. However, I would to retain one day in the calendar and if I select on another date I would like to have a blank textbox.

    Thanks

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. date picker activex control
    By mr2000 in forum Forms
    Replies: 1
    Last Post: 10-13-2010, 09:51 AM
  2. Missing Calendar Control 11.0
    By rnichols86 in forum Access
    Replies: 1
    Last Post: 10-04-2010, 04:11 PM
  3. Replies: 4
    Last Post: 08-02-2010, 06:31 AM
  4. Run query from calendar control
    By DaveyJ in forum Queries
    Replies: 1
    Last Post: 07-02-2010, 07:54 AM
  5. Access Calendar Control
    By JGG in forum Access
    Replies: 7
    Last Post: 04-03-2009, 04:34 AM

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