G
Guest
I have a form that has the location name in a combo box. When the user
selects the location it is linked to all forms.
The issue is when the user adds a record, the location number, which is the
key for the location in the combo box is needed. How do I get the location
number (key) to be automatically added to the new record being added without
the user having to enter the location name or location number.
Below is how I am keeping the location name to get to the new form.
Private Sub Command86_Click()
On Error GoTo Err_Command86_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "f_Route"
stLinkCriteria = "[BRANCH]=" & "'" & Me![cmboLocation] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command86_Click:
Exit Sub
Err_Command86_Click:
MsgBox Err.Description
Resume Exit_Command86_Click
End Sub
Thanks
Rick
selects the location it is linked to all forms.
The issue is when the user adds a record, the location number, which is the
key for the location in the combo box is needed. How do I get the location
number (key) to be automatically added to the new record being added without
the user having to enter the location name or location number.
Below is how I am keeping the location name to get to the new form.
Private Sub Command86_Click()
On Error GoTo Err_Command86_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "f_Route"
stLinkCriteria = "[BRANCH]=" & "'" & Me![cmboLocation] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command86_Click:
Exit Sub
Err_Command86_Click:
MsgBox Err.Description
Resume Exit_Command86_Click
End Sub
Thanks
Rick