Results 1 to 4 of 4
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Using a calendar in a text box on a form

    I've created two text boxes on a form. Both are formatted with short date. When the form is opened, only one text box is visible. The focus is set on the visible text box. Using the mouse, the user can select the date from the pop up calendar. All this works correctly. What I'm trying to do is get the second text box changed to visible after the first text box has a date within it. I've tried entering code in both the on click and after update events within text box 1, but nothing seems to work.



    Thanks in advance!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    User must commit the entered value to the field before the AfterUpdate event will trigger. This usually means pressing tab or enter key.

    The Click event works for me.

    Me.text2.Visible = True
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,930
    What I'm trying to do is get the second text box changed to visible after the first text box has a date within it.
    you could use the change event

    I've tried entering code in both the on click and after update events within text box 1, but nothing seems to work.
    what does 'nothing seems to work' mean? nothing happens? you get an error? screen goes blue?

  4. #4
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    The change event will fire after typing even just one character and upon each subsequent typed or deleted character, so that might cause unexpected behaviour. Unless you know of a way to prevent typing in the control while still allowing the use of the calendar, it doesn't sound suitable here. As June7 says, the after update wont' fire until focus moves off of the control. Try the textbox.dirty event (and maybe test for a valid date versus garbage text). I'm assuming your control is bound to a date field:

    Code:
    If IsDate(Me.Text1) Then
        Me.Command1.Visible = False
    End If

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

Similar Threads

  1. Replies: 35
    Last Post: 07-06-2015, 09:37 AM
  2. Replies: 5
    Last Post: 08-20-2012, 11:11 PM
  3. Replies: 1
    Last Post: 01-05-2012, 03:43 PM
  4. Form like calendar
    By mari_hitz in forum Forms
    Replies: 4
    Last Post: 10-18-2011, 09:04 AM
  5. pop up calendar in a form
    By jbedward in forum Access
    Replies: 1
    Last Post: 01-22-2010, 09:06 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