Missing Operator In Query Expression

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chucky

    #1

    Missing Operator In Query Expression

    I have been going crazy slowly all week. When I step through my code I
    get Run Time Error 3075, Syntax error, Missing Operator in Query
    Expression. I think that I have narrowed the error down to the next to
    last line of the following code, where the function MonthNumber is
    used. The fields that start with 'Choose' are fields on a form.
    StudentIDData is a variant. Can anybody help???? Please

    StrSQL = " SELECT tblStudentMaste r.[Last Name] AS LastName,
    tblStudentMaste r.[First name] AS FirstName, tblStudentMaste r.StudentID,
    tblStudentMaste r.status, tblStudentMaste r.Month,
    tblStudentMaste r.[Start Date] AS StartDate, tblStudentMaste r.YearX,
    tblStudentMaste r.Month, MonthNumber([Month]) AS MonthNbr, *" _
    & " FROM tblStudentMaste r" _
    & " WHERE (((tblStudentMa ster.StudentID) = " & StudentIDData & ")" _
    & " And ((tblStudentMas ter.Month) = """ & Me![ChooseMonth] & """)" _
    & " And ((tblStudentMas ter.YearX) = """ & Me![ChooseYear] & """))" _
    & " Or (((tblStudentMa ster.StudentID) = " & StudentIDData & ")" _
    & " And ((tblStudentMas ter.YearX) > """ & Me![ChooseYear] & """))" _
    & " Or (((tblStudentMa ster.StudentID) = " & StudentIDData & ")" _
    & " And ((tblStudentMas ter.YearX) = """ & Me![ChooseYear] & """)" _
    & " And ((MonthNumber(t blStudentMaster .[Month])) > " & "MonthNumber("" "
    & Me![ChooseMonth] & """)))" _
    & " ORDER BY tblStudentMaste r.YearX, MonthNumber([Month]);"

  • Jana

    #2
    Re: Missing Operator In Query Expression

    Chucky:

    One quick question:
    Is MonthNumber a custom function you have in your db? Does it do
    anything different than the built in Month function?

    Jana

    Comment

    • Chucky

      #3
      Re: Missing Operator In Query Expression

      Jana,

      MonthNumber returns a number when the argument is the MonthName. I
      created it and it resides in a module

      Chuck

      Comment

      • Chucky

        #4
        Re: Missing Operator In Query Expression

        Jana,

        MonthNumber returns a number when the argument is the MonthName. I
        created it and it resides in a module

        Chuck

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Is MonthNumber(<Mo nthName>) a Public Function?

          Comment

          • Bob Quintal

            #6
            Re: Missing Operator In Query Expression

            "Chucky" <cburdman@opton line.net> wrote in
            news:1146840659 .729285.196690@ i39g2000cwa.goo glegroups.com:
            [color=blue]
            > I have been going crazy slowly all week. When I step through
            > my code I get Run Time Error 3075, Syntax error, Missing
            > Operator in Query Expression. I think that I have narrowed the
            > error down to the next to last line of the following code,
            > where the function MonthNumber is used. The fields that start
            > with 'Choose' are fields on a form. StudentIDData is a
            > variant. Can anybody help???? Please
            >[/color]

            & " And ((MonthNumber(t blStudentMaster .[Month])) > " & "MonthNumbe r
            (""" & Me![ChooseMonth] & """)))" _

            has excessive parentheses and some superfluous quotes. You are also
            missing an underscore at the end of the upper line.
            & " And MonthNumber(tbl StudentMaster.[Month]) " _
            & " > MonthNumber(""" & Me![ChooseMonth] & """) " _

            --
            Bob Quintal

            PA is y I've altered my email address.

            Comment

            • Chucky

              #7
              Re: Missing Operator In Query Expression

              Thanks Bob, It works Fine Now !!!!!

              Comment

              • Bob Quintal

                #8
                Re: Missing Operator In Query Expression

                "Chucky" <cburdman@opton line.net> wrote in
                news:1146934303 .784609.203620@ g10g2000cwb.goo glegroups.com:
                [color=blue]
                > Thanks Bob, It works Fine Now !!!!!
                >
                >[/color]
                It makes me happy to hear that.


                --
                Bob Quintal

                PA is y I've altered my email address.

                Comment

                Working...