Results 1 to 7 of 7
  1. #1
    winterh is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    110

    Auto Pop a box with a date

    I have a form which has a number of fields one is a drop down with only one option "Done", what I want to happen is when a user selects "Done" it put todays date into a date box next to it.



    I guess this is a simply thing but I cant get my head around it.

    Thanks for the help.

    Hads

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Code:
    If Me.ComboName = "Done" Then
      Me.TextboxName = Date()
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    A Combobox with a single item is a bit of overkill, wouldn't you say?

    Also, what happens if the user makes a mistake? With a Combobox, you cannot simply go back in and select 'nothing!' The user would have to go in and physically delete the 'done' or you'd have to code something to set it back to Null, and do the same thing for the Textbox.

    Far better, for this kind of thing, to use a Checkbox named ckbDone and have its Label say Done. Then you could use

    Code:
    Private Sub ckbDone_AfterUpdate()
    
    If Me.ckbDone = -1 Then
      Me.TextboxName = Date()
    Else
      Me.TextboxName = Null
    End If
    
    End Sub

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    winterh is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    110
    Hi Guys

    I have to us a drop down as I have a number of options for the user to pick eg "Done", "Open" or Blank.

    This is the code I have used which seems to to put the date in "ToDoDoneDate1"

    If Me.ToDoStatus1 = "Done" Then
    Me.ToDoDoneDate1 = Date

    Any Ideas?

  5. #5
    winterh is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    110
    Hi Guys

    I have to us a drop down as I have a number of options for the user to pick eg "Done", "Open" or Blank.

    This is the code I have used which seems not to put the date in "ToDoDoneDate1"

    If Me.ToDoStatus1 = "Done" Then
    Me.ToDoDoneDate1 = Date

    Any Ideas?

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is there only 1 field in the combo, or perhaps is there a key field?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by winterh View Post
    Hi Guys

    ...I have to us a drop down as I have a number of options for the user to pick eg "Done", "Open" or Blank...
    If that's the case, why did you originally say:
    Quote Originally Posted by winterh View Post

    ...one is a drop down with only one option "Done"...
    We can't give valid advice if we're fed incorrect information!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Auto Date input
    By skyi in forum Access
    Replies: 6
    Last Post: 09-19-2012, 01:58 AM
  2. Auto date based on check box
    By bkirsch in forum Access
    Replies: 7
    Last Post: 01-15-2012, 11:38 AM
  3. auto date
    By wthoffman in forum Reports
    Replies: 6
    Last Post: 01-17-2011, 03:35 PM
  4. form question-auto date?
    By darklite in forum Access
    Replies: 4
    Last Post: 09-02-2010, 09:32 AM
  5. Auto populating date.
    By emccalment in forum Access
    Replies: 3
    Last Post: 02-19-2010, 11:00 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