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

Angielah

Registered User.
Local time
Today, 00:12
Joined
Jul 9, 2002
Messages
11
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
Next

End If
End Function

Would love some advice :confused:
 

Mile-O

Back once again...
Local time
Today, 00:12
Joined
Dec 10, 2002
Messages
11,316
Just make one query for each of these forms.
 

Users who are viewing this thread

Top Bottom