Results 1 to 4 of 4
  1. #1
    ninab is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    2

    Form Date/Time

    I have created a form, and wanted to be able to click on a button to change a field in the form from the existing date to a past date automatically with a click. However, I keep receiving an error message stating the value basically doesn't make sense. Here is what I have for codes:



    Private Sub Command15_Click()
    If Forms!AddOrderEntry!ActionSpecify = "RENEWAL" Then
    If MsgBox("Would you like to close this case?", vbQuestion + vbYesNo, "Confirm Closure?") = vbYes Then

    Me.CloseDate = Date - 1
    Me.Status.Visible = True
    Me.Refresh
    End If

    Else
    If Forms!AddOrderEntry!ActionSpecify = "DEACTIVATION" Then
    If MsgBox("Would you like to close this case?", vbQuestion + vbYesNo, "Confirm Closure?") = vbYes Then

    Me.CloseDate = Date
    Me.Status.Visible = True
    Me.Refresh
    End If

    End If

    End Sub


    I have already did numerous different ways, and none of them took. Datediff ("d"(date-1)) was one I tried. Can someone help me please????

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    For the purpose, syntax and samples of Access/vba functions, check with www.techonthenet.com

    Google techonthenet DateDiff access

  3. #3
    ninab is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    2
    Nothing in that site, that I can see, helps me with what I need. I am using Access 2010. The codes that were used for Access 2003 older worked, however in 2010 they don't.

    Me.Closedate = Date - 1

    This was used in the Access 2003 and older version and worked. It is not registering in 2010. For example, this field, CloseDate on the form, has an existing date of June 20, 2014. I want to be able to change that to June 19, 2014.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Date() function works for me

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

Similar Threads

  1. Subtracting a date/time field from a number to get date/time
    By Lifeseeker1019 in forum Programming
    Replies: 4
    Last Post: 03-28-2014, 12:59 PM
  2. Replies: 1
    Last Post: 03-13-2014, 07:23 PM
  3. Replies: 4
    Last Post: 03-06-2013, 02:32 PM
  4. Date and Time Query Off Of Form
    By Joopster in forum Queries
    Replies: 4
    Last Post: 02-19-2013, 08:01 PM
  5. Replies: 6
    Last Post: 01-04-2011, 05:43 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