By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

QueryDef Parameters etc

P: n/a
Neither of these work. Why?

--------------------------
example 1:

StrQryDef = "SELECT zqUsageMailOutList.TG_CNTRCT_ID " _
& "FROM zqUsageMailOutList " _
& "WHERE (((zqUsageMailOutList.TG_CNTRCT_ID)= " & strCriteria & "));"

example 2:

qd.Parameters!Selection = "5822486430033 OR 5822486430036"
'strCriteria

--------------------------

Aug 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
A little more information. What I was hoping to do was build up a
WHERE criteria string using NOT and ONLY (AND/OR) and using it as a
QueryDef Parameter like this:

--------------------
Dim strCriteria As String
Dim varItem As Variant
If Me.Frame12 = 1 Then 'NOT
For Each varItem In Me.List3.ItemsSelected
strCriteria = strCriteria & " AND NOT " & Me.List3.Column(0, varItem)
Next varItem
strCriteria = Mid(strCriteria, 6)
End If
If Me.Frame12 = 2 Then 'ONLY
For Each varItem In Me.List3.ItemsSelected
strCriteria = strCriteria & " OR " & Me.List3.Column(0, varItem)
Next varItem
strCriteria = Mid(strCriteria, 5)
End If
End If
-----------------------

Gives me an arbitrary length string:

# OR # OR # ....
# AND NOT # AND NOT # ....

--
Christian

Aug 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.