Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    204

    Unanswered: Need Help with selecting records between 2 dates in other records

    As usual, since I'm a beginner, I don't know what I should put instead of this, but when the debugger comes up it highlights "Between".

    What I want to do is, there are 2 dates (Q Num Start Date) and (Q Num End Date) in tbl_EmployeeTable, and I want it to give me a msgbox if the data in field (QNumber) in the current form was used between those 2 dates.

    Here is what I have so far....The 2nd part works fine, the first If statement is what I'm having my problem with.

    Code:
    If Me.QNumber Is BETWEEN(DLookup("Q Num Start Date", "tbl_EmployeeTable")) And (DLookup("Q Num End Date", "tbl_EmployeeTable")) Then
    MsgBox "This QX Number Was Already Used This Month!"
    Else
    
        If Me.Department <> "" Then
        DoCmd.GoToRecord , , acNewRec
        Else
        MsgBox "In order to add a record, you must have a department!"
        Exit Sub
        End If
    
    End If

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I believe Between is only valid in SQL, so you'd have to use ">=" and "<=". I don't think that's going to be the end of your problems, but let's start there.
    Paul

Posting Permissions

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