How open form if only one record exists in query?

I'm using the onopen event of a form to determine if a second form should open right to a record.  

Here is my code which isn't anywhere near right I'm sure.  Can someone help?

Private Sub Form_Open(Cancel As Integer)

    Dim recordcount As Integer
    If recordcount = 1 Then
        DoCmd.OpenForm "frmIndividuals", acNormal, , "[IndividualID]=" & Me.txtIndividualID, acFormEdit, acWindowNormal
    End If

End Sub
SteveL13Asked:
Who is Participating?
 
mbizupConnect With a Mentor Commented:
Try

Me.recordsetclone.movelast
If me.recordsetclone.recordcount =1 then
   Etc
End if
0
 
SteveL13Author Commented:
Perfect!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.