FindFirst trouble

  • Thread starter Bradley C. Hammerstrom
  • 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.
 
B

Bradley C. Hammerstrom

Got it on my own:

Change one line (removed quote marks around variable):

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top