Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2005
    Posts
    144

    Red face Unanswered: Click Checkbox to add date in a text box

    Hello All,
    I have built a database for ordering parts and as soon as i receive parts i then check the box called received and it takes that entry away from the form and keeps it in the table, however i want the received orders archived from the date they were checked on.

    I am using 0 criteria for the checked box field which basically removes it from the form but keeps it in the table however i want another field to have a date/time added as soon as the box is checked.

    I hope i am making sense.
    I have tried several ways of making a on click event but i cant get the code to work right.
    Any help would be wonderful

    Thanks
    Attached is my database
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You need to add a textbox to your form called, for instance, ReceivedDate, formatted as a date. In the Properties box set its Control Source as RecievedDate. Then in VBA code enter:

    Private Sub Recieved_Click()
    Me.ReceivedDate.Value = Now()
    End Sub

    When you click on the Recieved checkbox the date will be placed on your form and in your table.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    Private Sub Recieved_Click()
    Me.ReceivedDate.Value = Now()
    Me.Requery
    End Sub
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    Jul 2005
    Posts
    144

    Angry Where do I enter the VBA code?

    Quote Originally Posted by Missinglinq
    You need to add a textbox to your form called, for instance, ReceivedDate, formatted as a date. In the Properties box set its Control Source as RecievedDate. Then in VBA code enter:

    Private Sub Recieved_Click()
    Me.ReceivedDate.Value = Now()
    End Sub

    When you click on the Recieved checkbox the date will be placed on your form and in your table.
    Thanks to Missinglinq and Myle for the prompt reply!
    I went ahead and createda field called ReceivedDate properties set to shortdate and after placing that code to onclick event of the received checkbox and it work flawlessly.

    You guys are just awsome, i know i can always count on you.
    thanks again
    Last edited by ranjah; 09-11-06 at 14:39.

  5. #5
    Join Date
    Jul 2005
    Posts
    144
    I have one more question, How do I enter a comment such as " Are you sure you want to received that order" before it executes the command?

    Thanks again

  6. #6
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    try some like

    Code:
    if msgbox("Are you sure you want to received that order",vbYesNo)  = vbYes then 
    Me.ReceivedDate.Value = Now()
    Me.Requery
    Else
    
    End if
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  7. #7
    Join Date
    Jul 2005
    Posts
    144
    Thanks Myle!
    that worked just fine

Posting Permissions

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