B
BrettS
Hi,
I've been using the common VBA code for using a combobox to go to a
particular record, I believe it may have been written by one of the MVPs
here. The code is:
Private Sub Filtercategory_AfterUpdate()
On Error GoTo err_Handler
Dim rs As DAO.Recordset
If Not IsNull(Me.Filtercategory) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[File Category] = """ & Me.Filtercategory & """"
If rs.NoMatch Then
MsgBox "Not found: Try Another Record"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
Me.Filtercategory = ""
Me.Refresh
exit_Here:
Exit Sub
err_Handler:
MsgBox Err.Number & ": " & Err.Description, vbCritical, "***ERROR***"
End Sub
I was wondering if I could use a combobox with two columns and an SQL query
showing two fields from the table to filter for two fields at once? I'm
guessing I'd need to change this line:
rs.FindFirst "[File Category] = """ & Me.Filtercategory & """"
But I'm not familiar enough with VBA to know the syntax or if that is
possible. The second field is called [File ID #].
Thank you in advance for any help,
Brett
I've been using the common VBA code for using a combobox to go to a
particular record, I believe it may have been written by one of the MVPs
here. The code is:
Private Sub Filtercategory_AfterUpdate()
On Error GoTo err_Handler
Dim rs As DAO.Recordset
If Not IsNull(Me.Filtercategory) Then
If Me.Dirty Then
Me.Dirty = False
End If
Set rs = Me.RecordsetClone
rs.FindFirst "[File Category] = """ & Me.Filtercategory & """"
If rs.NoMatch Then
MsgBox "Not found: Try Another Record"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
Me.Filtercategory = ""
Me.Refresh
exit_Here:
Exit Sub
err_Handler:
MsgBox Err.Number & ": " & Err.Description, vbCritical, "***ERROR***"
End Sub
I was wondering if I could use a combobox with two columns and an SQL query
showing two fields from the table to filter for two fields at once? I'm
guessing I'd need to change this line:
rs.FindFirst "[File Category] = """ & Me.Filtercategory & """"
But I'm not familiar enough with VBA to know the syntax or if that is
possible. The second field is called [File ID #].
Thank you in advance for any help,
Brett