For a combo box to both navigate to a customer record, and go to a new record (thus avoiding the need for a separate button) you'd replicate that in my demo by having the following as the combo box's RowSource:
SELECT CustomerID,
FirstName & " " & LastName, 1 As SortColumn,
LastName,Firstname
FROM Customers
UNION
SELECT 0, "<New Customer>", 0,"",""
FROM Customers
ORDER BY SortColumn, LastName, FirstName;
It's other properties would be:
BoundColumn: 1
ColumnCount: 2
ColumnWidths: 0cm
If your units of measurement are imperial rather than metric Access will automatically convert the unit of the last one to inches. The important thing is that the dimension is zero to hide the first column.
The code for the combo box's AfterUpdate event procedure would be like this:
Const MESSAGETEXT = "No matching record"
Dim ctrl As Control
Set ctrl = Me.ActiveControl
If Not IsNull(ctrl) Then
If ctrl = 0 Then
' go to new record and move focus to FirstName control
DoCmd.GoToRecord acForm, Me.Name, acNewRec
Me.FirstName.SetFocus
Else
With Me.RecordsetClone
.FindFirst "CustomerID = " & ctrl
If Not .NoMatch Then
' go to record by synchronizing bookmarks
Me.Bookmark = .Bookmark
Else
MsgBox MESSAGETEXT, vbInformation, "Warning"
End If
End With
End If
End If
The code for the form's Current event procedure would be:
' synchronize go to contact combo box
' with current record
Me.cboGotoCustomer = Me.CustomerID
where cboGotoCustomer is the name of the combo box.
The code for both the form's AfterUpdate event and AfterDelConfirm event procedures would be:
' requery go to contact combo box
' to reflect changes to data
Me.cboGotoCustomer.Requery
' synchronize go to contact combo box
' with current record
Me.cboGotoCustomer = Me.CustomerID
With a bound form you don't need a button to save the record. This is automatically done when you move to another record, close the form or explicitly save the record in some other way such as clicking on the record selector.