L
lhtan123
I have a form that is bound to a "Company" table as recordsource. This has a
listbox that displays all companies and a textbox for entering new company.
The table only has one field which is called "Company" and it is also the
primary key. Supposed i enter a new record called "Alpha" in the form, an
existing record that also starts with "a" will be overwritten.
I tried to create a button to purposely check for similar record before
saving but it gave me a compile error: Sub or Function not defined". Below is
the code:
Private Sub btnUpdateLCo_Click()
With Me.RecordsetClone
FindFirst "[Liason Company] = """ & Me.txtNewLCo & """"
If .NoMatch Then
Me.Dirty
Else
MsgBox "Similar record is found!", vbInformation, "Liason Company"
End If
End With
End Sub
listbox that displays all companies and a textbox for entering new company.
The table only has one field which is called "Company" and it is also the
primary key. Supposed i enter a new record called "Alpha" in the form, an
existing record that also starts with "a" will be overwritten.
I tried to create a button to purposely check for similar record before
saving but it gave me a compile error: Sub or Function not defined". Below is
the code:
Private Sub btnUpdateLCo_Click()
With Me.RecordsetClone
FindFirst "[Liason Company] = """ & Me.txtNewLCo & """"
If .NoMatch Then
Me.Dirty
Else
MsgBox "Similar record is found!", vbInformation, "Liason Company"
End If
End With
End Sub