473,765 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

QueryDef Parameters etc

Neither of these work. Why?

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

StrQryDef = "SELECT zqUsageMailOutL ist.TG_CNTRCT_I D " _
& "FROM zqUsageMailOutL ist " _
& "WHERE (((zqUsageMailO utList.TG_CNTRC T_ID)= " & strCriteria & "));"

example 2:

qd.Parameters!S election = "5822486430 033 OR 5822486430036"
'strCriteria

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

Aug 10 '07 #1
1 2133
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.ItemsS elected
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.ItemsS elected
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5039
by: hpi | last post by:
Hello, I have a table : Batch It contains fields batchnummer : Number (Long Integer) datum : Date/Time status : Number (Long Integer) nr_records : Number (Long Integer)
1
4160
by: VBSponge | last post by:
Hi all. Need help here as I cant see whats wrong... I have a querydef in Access 2k which execs a stored proc in a SQL Server 2k db. I keep getting the following error, and cant stop it for the life of me: "Error 3146: ODBC Call Failed" Now, the stored proc uses @RETURN_VALUE to pass back an integer result
6
4187
by: Tim Marshall | last post by:
A2003, but this behaviour also occurred during the same DAO process I'm about to describe in A97. I have a sub procedure which takes two arguments: a querydef name; and an SQL statement constructed from the calling procedure and constructs or modifies a querydef. The sub runs through the querydefs collection - if it finds the querydef name argument, it takes the existing query and modifies the SQL. If not found, a new querydef is...
21
5772
by: Marc DVer | last post by:
I am trying to create a query that can be loaded as a querydef object but not having to assign values to the parameters if I don't want to. Normally when using a parameter query in VBA my code would go something like this: dim qry as dao.querydef set qry = currentdb.querydefs("myquery") qry.parameters("Par1") = "blah"
2
2707
by: BerkshireGuy | last post by:
I have the following code: Dim strSQL As String Dim DB As DAO.Database Dim RS As DAO.Recordset Dim intNumOfPaid, intNumOfHypoed, intNumOfNotTaken, intNumOfDeclined, intNumOfWasted, intNumOfApproved As String Dim QDF As QueryDef Dim PARAM As Parameter
0
1392
by: AP | last post by:
I use the following snippet to open a build a querydef. This works great with a query that has a parameter that points to a form, but if I try to use it in a parameter query, even if the parameter is defined I get the following error 2482 Access cant find the name 'enter year' you entered in your expression. 'This is the code snippet I use to open see below for an example of
1
2297
by: tom taol | last post by:
table1 has 2 fields. Query1 is following. ========================= INSERT INTO Table1 ( fld1, fld2 ) SELECT AS Expr1, AS Expr2 FROM Table1; Private Sub Command0_Click()
19
10185
by: phytorion | last post by:
My problem is that my code doesn't seem to be passing the parameter values to the query. I'm not very profiencient in access so i'm not sure where its going wrong. On Error GoTo WriteTableInfoTo_SRCE_TBL_STRUCTUREErr Dim strErrorMsg As String Dim db As DAO.Database, qd As DAO.QueryDef Dim varRelate As Variant ' Check for related child rows ' Get a pointer to this database
6
4416
by: LSteve | last post by:
I am a newbie at VBA and in need of some help with how best to create a recordset from an existing Access Query that requires 2 Parameters from an open form. This query works fine as an ordinary query but i just can't get it to work using VBA. The 2 fields in the form to be used as parameters are and . I am working with Access 2003 in Win XP. I have Microsoft DAO 3.6 in the references. Thanks in advance for any help. My code is: Dim qdf as...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.