Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Findfirst Syntax Error 2

Status
Not open for further replies.

grinnz

Technical User
Aug 20, 2006
11
US
Code:
    Dim dbs As Database
    Dim rstCombined As DAO.Recordset
    Dim rstExceptions As DAO.Recordset
    Dim strCompare As String
    
    'Open Recordsets
    Set dbs = CurrentDb
    Set rstCombined = dbs.OpenRecordset("qryCombined")
    Set rstExceptions = dbs.OpenRecordset("qryExceptions")
    
    'Find/Delete Exceptions
    With rstCombined
        rstExceptions.MoveFirst
        .MoveFirst
        
        Do While Not rstExceptions.EOF
            strCompare = rstExceptions!exceptkey
            [COLOR=red].FindFirst "CombineKey=" & strCompare[/color]
            If .NoMatch = False Then
                .Delete
            End If
            rstExceptions.MoveNext
        Loop
    End With
    
    rstCombined.Close
    rstExceptions.Close
    Set dbs = Nothing
                
End Sub

I am receiving a "runtime 3077, syntax error (missing operator) in expression" error. 'CombineKey' is a valid field in the recordset and strCompare contains a value when the program halts. I'm a newbie and am stumped. Your help is appreciated.

~ grinnz ~

Listen to me online every Tue/Thu 6-9pm Eastern
 
Try it like this

.FindFirst "[CombineKey] = " & strCompare

What is rstExceptions!exceptkey

??? maybe Forms!rstExceptions!exceptkey

HTH

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Hi!

Is CombineKey numeric? If not you need to do this:

.FindFirst "CombineKey='" & strCompare & "'"

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
and hashes for a date "#" & strcompare & "#"

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Thank you for your reply. "[CombineKey]=" I have tried with the same resulting runtime error. The exceptkey statement above is fine unto the fact that when the program stops it points specifically to the findfirst statement. Further, the variable strCompare has already been populated with the proper value with the assignment statement above.

To elaborate, both ExceptKey and CombineKey are text fields and are named as such in both the table and the respective queries in which they are contained. The form that I use has only one field called 'text3' that is bound to the CombineKey field in the query.

The only other piece of information that I should perhaps offer is that the tblExceptions on which one of the queries is based is a linked table although qryExceptions is local to my project file.

~ grinnz ~

Listen to me online every Tue/Thu 6-9pm Eastern
 
Very odd since the code you provided should be working... you are saying that strCompare contains the value you need.... maybe test without strcompare and entering the value manually, from there, try modifying the line until it works...

try to isolate the error this way, but looking at what you provided I don't see what is wrong...

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top