G
Guest
I have the following code in place to search my table for a record matching
the text entered into an unbound textbox:
Private Sub Text14_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.Text14) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[Part ID] = """ & Me.Text14 & """"
If rs.NoMatch Then
DoCmd.S
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
I would like to change the following portion of the code so that if the
record is not found, it automatically copies the text in the unbound textbox
and pastes it into the "Part ID" field of my form creating a new record in my
table:
If rs.NoMatch Then
DoCmd.S
MsgBox "Not found: filtered?"
Any help would be greatly appreciated.
the text entered into an unbound textbox:
Private Sub Text14_AfterUpdate()
Dim rs As DAO.Recordset
If Not IsNull(Me.Text14) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[Part ID] = """ & Me.Text14 & """"
If rs.NoMatch Then
DoCmd.S
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
End Sub
I would like to change the following portion of the code so that if the
record is not found, it automatically copies the text in the unbound textbox
and pastes it into the "Part ID" field of my form creating a new record in my
table:
If rs.NoMatch Then
DoCmd.S
MsgBox "Not found: filtered?"
Any help would be greatly appreciated.