Passing logic operators to query

Local time
Today, 03:35
Joined
Feb 2, 2020
Messages
54
I am attempting to pass logic operators via TempVars to query to filter a list box. What is the proper syntax as "<>5" does not seem to pass to the query properly? Sample DB attached.


Private Sub Frame0_AfterUpdate()
Select Case Frame0.Value
Case 1
TempVars.Add "tmpSelected", "<>5"
Case 2
TempVars.Add "tmpSelected", "5"
End Select
List9.Requery
End Sub
 

Attachments

Not possible. You can only pass "data" values as arguments. Relational operators are structural. Changing the operator might change the execution plan of the query and since that is saved with the querydef, you can't change it on the fly. Changing companyID from 123 to 887 does not impact the methodology used for selecting rows because you are just changing a data value.

If you build the SQL string using VBA, you can do whatever you want.
 

Users who are viewing this thread

Back
Top Bottom