Query criteria can either have a value or not problem (1 Viewer)


Registered User
Jul 9, 2002
I need help.
I have a query that can either have criteria specified in a field or not depending on the form that is open. I have a function in the criteria field that is supposed to determine this.

I'm having problems working out how to assign a value to the criteria field that means "no criteria specified". Everything I try is assigning it as a string with dire results.

This is the code so far.....

Function AgentId(Agent_ID)
Dim frm As Form
Dim intForms As Integer
Dim intI As Integer
Dim AgentString As String

intForms = Forms.count
If intForms > 0 Then
For intI = 0 To intForms - 1
Set frm = Forms(intI)
FormName = frm.Name
If FormName = "frmAgentHistory" Then
AgentId = Forms!frmAgentHistory![TxtID]
ElseIf FormName = "frmAllAgentHistory" Then
AgentId = Not Empty
End If

End If
End Function

Would love some advice :confused:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom