Code Issues

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

keep getting an error when I use the folloeing code. This code is a refresh
button that takes you back to the last record you were viewing when you
presses refresh. Please can some one help me. Below is the error type as
well as the code:
Error Type: Run-Time Error '3077
Syntax Error (missing Operator) in expression


Private Sub Refreshfrom_Click()
Dim strLCNumber As Variant 'To save the primary key

If Me.Dirty Then 'Save First
Me.Dirty = False
End If
strLCNumber = Me.strLCNumber

Me.Requery

If IsNull(strLCNumber) Then 'Must have been a new record
RunCommand acCmdRecordsGoToNew
Else
With Me.RecordsetClone
.FindFirst "strLCNumber= " & strLCNumber ' this is where I keep
getting the error.
If .NoMatch Then
MsgBox "Disappeared."
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub
 
It is pretty easy to confuse Access if you name Fields, Controls and
Variables the same name.

Try:
.FindFirst "[strLCNumber] = " & strLCNumber
...and see if that helps. I would suggest you give each object a slightly
different name.
 
Back
Top