relatively new to VBA, but have a working 'search' box for my form. Below is the code, and the row source is a query which takes all the names from the Table1.
Form1 and Form2 display the names from Table1 in locked combo boxes (to prevent accidental editing) and the remainder of the forms can be filled in or edited.
The problem is I need to add code such that when a name is pulled up from Table1 in Form2 where there is no record yet the form will create a new record with just the name filled in.
I imagine it has something to do with an
Code:
If 'not found' Then oCmd.GoToRecord , , acNewRec
But i don't know what goes in the If statement.
Help!
Code for search box:
Code:
Private Sub cboFind_AfterUpdate()
Me.AllowEdits = True
DoCmd.ShowAllRecords
Me!Last_Name.SetFocus
DoCmd.FindRecord Me!cboFind, acEntire, , acSearchAll, , acEntire, True
End Sub