Results 1 to 4 of 4

Thread: Date Issue

  1. #1
    Join Date
    Mar 2009
    Posts
    16

    Unanswered: Date Issue

    Hi,

    When I press next record my date is changing but only in dd/mm/yyyy format I want it to be in Long date format when pressing next record button. This is day by day.

    This is what I have but I am also having issues with this now as well.

    Private Sub Command542_Click()

    End Sub

    Private Sub Prev_record_Click()
    On Error GoTo Err_Prev_record_Click

    Date.DefaultValue = """" & DateAdd("d", -1, Date) & """"
    DoCmd.GoToRecord , , acPrevious

    Exit_Prev_record_Click:
    Exit Sub

    Err_Prev_record_Click:
    MsgBox Err.Description
    Resume Exit_Prev_record_Click

    End Sub
    Private Sub Next_record_Click()
    On Error GoTo Err_Next_record_Click

    Date.DefaultValue = """" & DateAdd("d", 1, Date) & """"
    DoCmd.GoToRecord , , acNext

    Exit_Next_record_Click:
    Exit Sub

    Err_Next_record_Click:
    MsgBox Err.Description
    Resume Exit_Next_record_Click

    End Sub


    Thanks in advance

  2. #2
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Seems like you wouldn't want to name a field or control "Date" as that is a reserved word.

    And for your date field perhaps set the Format property to be Long Date.
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Mar 2009
    Posts
    16

    Do you have an example

    Can you please send me an example on how to make the date add 1 day everytime i press a button. all in long date. I changed the field but it kept on going back to dd/mm/yyyy after pressing next record

  4. #4
    Join Date
    Mar 2009
    Posts
    16
    Quote Originally Posted by Bullschmidt
    Seems like you wouldn't want to name a field or control "Date" as that is a reserved word.

    And for your date field perhaps set the Format property to be Long Date.
    I haVE DONE ALL THE formatting but I still get a Type mismatch from this


    Private Sub Command542_Click()

    End Sub

    Private Sub Prev_record_Click()
    On Error GoTo Err_Prev_record_Click

    Mydate.Format = "Long Date"
    Mydate.DefaultValue = """" & DateAdd("d", -1, Mydate) & """"
    DoCmd.GoToRecord , , acPrevious

    Exit_Prev_record_Click:
    Exit Sub

    Err_Prev_record_Click:
    MsgBox Err.Description
    Resume Exit_Prev_record_Click

    End Sub
    Private Sub Next_record_Click()
    On Error GoTo Err_Next_record_Click
    Dim MyResult

    MyResult = Format(Mydate, "long date")
    Mydate.DefaultValue = """" & DateAdd("d", 1, Mydate) & """"


    DoCmd.GoToRecord , , acNext

    Exit_Next_record_Click:
    Exit Sub

    Err_Next_record_Click:
    MsgBox Err.Description
    Resume Exit_Next_record_Click

    End Sub

    thanks again

Posting Permissions

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