Run time error 3077

Posted on 2005-05-12
Last Modified: 2012-05-05
I am receiving a run time error '3077' Syntax error (missing operator) in expression on the following line:
 -   rec.FindFirst "FileID = " & rs("FileID").Value & "ClassID = " & classnum
the code is provided below:

If intResult = vbYes Then
 StrSQL1 = "SELECT * FROM Employee_Train"
 Set db = CurrentDb()
 Set rs = db.OpenRecordset(StrSQL, dbOpenSnapshot, dbReadOnly)
 Set rec = db.OpenRecordset(StrSQL1, dbOpenSnapshot)
 Do Until rec.EOF
  rec.FindFirst "FileID = " & rs("FileID").Value & "ClassID = " & classnum
   If rec.NoMatch = False Then
    With rec
      .Fields("FileID") = rs("FileID").Value
      .Fields("OccupationID") = rs("OccupationID").Value
      .Fields("ClassID") = "& classnum &"
      .Fields("ClassTaken") = False
      .Fields("Date_Ent") = Format(CDate(todaydat), "dd/mm/yyyy")
     End With
     End If
     Set db = Nothing
     End If
     End If
Question by:tupac1979
    LVL 65

    Accepted Solution

    Try this...

    rec.FindFirst "FileID = " & rs("FileID").Value & " AND ClassID = " & classnum
    LVL 7

    Expert Comment

    if my presumption is correct, cause I never use Findfirst

    you should change
    "FileID = " & rs("FileID").Value & "ClassID = " & classnum

    "FileID = " & rs("FileID").Value & " and ClassID = " & classnum

    Author Comment

    Thanks Jim that worked

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now