Allowing selection of null from combobox

I am definitely using the combo box's recordsource as the Status table. My AfterUpdate code is as follows:

Code:
Private Sub CboStatus_AfterUpdate()
Dim mystatus As String
mystatus = "Select * from tblFGTracking where ([status] = '" & Me.CboStatus & "')"
Me.tblFGTracking_subform.Form.RecordSource = mystatus
Me.tblFGTracking_subform.Form.Requery
Me.Total = FindRecordCount(mystatus)
End Sub
 
I am definitely using the combo box's recordsource as the Status table. My AfterUpdate code is as follows:
I meant recordsource of form. Ok yes, so your code might change to:
Code:
Private Sub CboStatus_AfterUpdate()
Dim mystatus As String
if Me.CboStatus ="Blank" then
    mystatus="Select * from tblFGTracking where [status]='' or [status] is null"
else
    mystatus = "Select * from tblFGTracking where ([status] = '" & Me.CboStatus & "')"
end if
Me.tblFGTracking_subform.Form.RecordSource = mystatus
Me.tblFGTracking_subform.Form.Requery
Me.Total = FindRecordCount(mystatus)
End Sub
...and you would need to add the record with value "Blank" into the table that is the rowsource of the combo box.
 
That worked perfectly! Thank you!
 

Users who are viewing this thread

Back
Top Bottom