FindFirst trouble

  • Thread starter Thread starter Bradley C. Hammerstrom
  • Start date Start date
B

Bradley C. Hammerstrom

Access2000 DAO 3.6

I almost have this working. The idea is to view a photo on the Main form and
click a button to view the same photo in a different Context form. The
OpenForm statement in the Else section works fine when the Context form is
not yet open, but when the form is loaded I get an error.

Error: Data type mismatch in criteria expression (in the FindFirst line).

I must have the syntax wrong somehow.

On Click Event on formMain, where PhotoID is in the subform:
********
Private Sub cmdGoTofrmContext_Click()
Dim strFormName As String
Dim strPhotoRecord As String
strFormName = "frmContext"
strPhotoRecord = Me.frmMainSub1.Form.PhotoID

If IsLoaded(strFormName) Then
'Bring the form on top
Forms(strFormName).SetFocus
'Go to same photo
Forms.frmContext.Recordset.FindFirst "PhotoID= """ & strPhotoRecord &
""""
Else
'Open frmContext and go to same photo
DoCmd.OpenForm strFormName, , , OpenArgs:=strPhotoRecord
End If
End Sub
********

Brad H.
 
Got it on my own:

Change one line (removed quote marks around variable):

Forms.frmContext.Recordset.FindFirst "PhotoID= " & strPhotoRecord
 
Back
Top