Hello everyone. I must say this has completely frustrated me. I'm using acces '97 and I'm trying to open a form to a specific record.
This is the code that I am using to initially open the form
And this is the code I'm using when the form opens to find the specific record.
The Problem is that even when there is a matching record it still creates a new record. Can anyone tell me what I'm doing wrong here??
This is the code that I am using to initially open the form
Code:
Private Sub Command18_Click()
If Me.NewRecord Then
MsgBox "Please enter a tool number to continue.", vbOKOnly, "APQP Warning"
Exit Sub
End If
DoCmd.OpenForm "sbfrmCommentsTooling", acNormal, , , , , Forms!sbfrmActionItems!sbfrmTooling!txtID.Value
End Sub
And this is the code I'm using when the form opens to find the specific record.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim rec As Recordset
DoCmd.Restore
Set rec = Me.RecordsetClone
If rec.RecordCount < 1 Then
DoCmd.GoToRecord , , acNewRec
Me!txtIDvalue.Value = Me.OpenArgs
Else
rec.FindFirst [ID] = Me.OpenArgs
If rec.NoMatch Then
DoCmd.GoToRecord , , acNewRec
Me!txtIDvalue.Value = Me.OpenArgs
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End If
End Sub
The Problem is that even when there is a matching record it still creates a new record. Can anyone tell me what I'm doing wrong here??