Searchbox with a where clause?

fat controller

Slightly round the bend..
Local time
Today, 23:24
Joined
Apr 14, 2011
Messages
758
I have a form with a search box and related button to execute the search.

The code for the search is as follows:

Code:
Dim varInput
 varInput = Me.txtSearch.Value
 Me.txtEmployeeNumber.Visible = True
Me.txtEmployeeNumber.SetFocus
DoCmd.FindRecord varInput, acEntire, , acSearchAll, False, acCurrent
 
If IsNull(Me.txtEmployeeNumber) Then
MsgBox "Employee Not Found.  Please search again, or follow procedure to add new employee", vbOKOnly
Me.txtSearch.SetFocus
Me.txtEmployeeNumber.Visible = False
Me.txtSearch = Null
 
Else
 Me.txtEmployeeNumber.Visible = True
Me.EmployeeOK.Visible = True
 me.EmployeeName.Visible=True
me.txtSearch=Null
DoCmd.GoToControl "txtEmployeeName"
 End If
 End Sub

This works perfectly well on more than one form, however on this particular form I only want it to search records where a field ([Complete_Date]) is null

Is there a way to add a where clause to the search above?
 
Ignore me - I was being thick. The solution of course is to have a Query that only shows records that have the chosen field with a null value.

I really need to get some sleep.........
 

Users who are viewing this thread

Back
Top Bottom