C
Chrissy
Our employees are assigned locations to work. The
locations are stored in a table and, as I have
discovered, not all locations are used. They do need to
be available for use, however.
My form and the location combo box work fine when a
location in the source table is used by at least one
employee. (Thanks again Rick Brandt.) When a location in
the source is not used by ANY employee (presently), the
combo box returns a blank form. Selecting another
location returns the message "no current record." No
surprise. I have attempted to test for null or empty
string to no avail.
Question is, using the following code, how do I manage to
stay on the open form whereby I can select another
location? Presently I must close and restart the form.
Can anyone shed light? Thanks in advance.
Chrissy
My code:
Private Sub cboLocation_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Location] = '" & Me![cboLocation] & "'"
Me.Bookmark = rs.Bookmark
Me.Filter = "[Location]='" & Me.cboLocation & "'"
Me.FilterOn = True
Me.cboLocation.SetFocus
End Sub
locations are stored in a table and, as I have
discovered, not all locations are used. They do need to
be available for use, however.
My form and the location combo box work fine when a
location in the source table is used by at least one
employee. (Thanks again Rick Brandt.) When a location in
the source is not used by ANY employee (presently), the
combo box returns a blank form. Selecting another
location returns the message "no current record." No
surprise. I have attempted to test for null or empty
string to no avail.
Question is, using the following code, how do I manage to
stay on the open form whereby I can select another
location? Presently I must close and restart the form.
Can anyone shed light? Thanks in advance.
Chrissy
My code:
Private Sub cboLocation_AfterUpdate()
'Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Location] = '" & Me![cboLocation] & "'"
Me.Bookmark = rs.Bookmark
Me.Filter = "[Location]='" & Me.cboLocation & "'"
Me.FilterOn = True
Me.cboLocation.SetFocus
End Sub