I have a Database Called FalconAnalysis. mdb. The table I am wanting to use is called Generic Material. The Query I want to pass the value into is called Material Query. The field in the query is called Order_Model. I would like to pass the result, "strSize", from the following string of code into the Order_Model field of Material Query, which looks at generic Material Table. -
Private Sub MakeFilter2()
-
-
strSize = ""
-
-
If Nz(chkv2125S, False) Then _
-
strSize = strSize & ",'150'"
-
If Nz(chkv2125H, False) Then _
-
strSize = strSize & ",'151'"
-
If Nz(chkv215S, False) Then _
-
strSize = strSize & ",'180'"
-
If Nz(chkv215H, False) Then _
-
strSize = strSize & ",'181'"
-
If Nz(chkv2175S, False) Then _
-
strSize = strSize & ",'210'"
-
If Nz(chkv2175H, False) Then _
-
strSize = strSize & ",'211'"
-
If Nz(chkv220S, False) Then _
-
strSize = strSize & ",'240'"
-
If Nz(chkv220H, False) Then _
-
strSize = strSize & ",'241'"
-
If Nz(chkv225S, False) Then _
-
strSize = strSize & ",'300'"
-
If Nz(chkv225H, False) Then _
-
strSize = strSize & ",'301'"
-
-
-
End Sub
-
I think it should be a like statment, any thoughts on how to do this?
10 3402 ADezii 8,834
Recognized Expert Expert
I have a Database Called FalconAnalysis. mdb. The table I am wanting to use is called Generic Material. The Query I want to pass the value into is called Material Query. The field in the query is called Order_Model. I would like to pass the result, "strSize", from the following string of code into the Order_Model field of Material Query, which looks at generic Material Table. -
Private Sub MakeFilter2()
-
-
strSize = ""
-
-
If Nz(chkv2125S, False) Then _
-
strSize = strSize & ",'150'"
-
If Nz(chkv2125H, False) Then _
-
strSize = strSize & ",'151'"
-
If Nz(chkv215S, False) Then _
-
strSize = strSize & ",'180'"
-
If Nz(chkv215H, False) Then _
-
strSize = strSize & ",'181'"
-
If Nz(chkv2175S, False) Then _
-
strSize = strSize & ",'210'"
-
If Nz(chkv2175H, False) Then _
-
strSize = strSize & ",'211'"
-
If Nz(chkv220S, False) Then _
-
strSize = strSize & ",'240'"
-
If Nz(chkv220H, False) Then _
-
strSize = strSize & ",'241'"
-
If Nz(chkv225S, False) Then _
-
strSize = strSize & ",'300'"
-
If Nz(chkv225H, False) Then _
-
strSize = strSize & ",'301'"
-
-
-
End Sub
-
I think it should be a like statment, any thoughts on how to do this?
Looks more like the In Construct to me:
strPassSQL = "In(" & strSize & ")"
Looks more like the In Construct to me:
strPassSQL = "In(" & strSize & ")"
Does that go into the query, or the VB code?
Rabbit 12,516
Recognized Expert Moderator MVP
Looks more like the In Construct to me:
strPassSQL = "In(" & strSize & ")"
You can't have this as the criteria of a query though. I don't think there's a way to run code which will change the criteria of a query from the query itself.
You'll most likely have to do it through a form.
You can't have this as the criteria of a query though. I don't think there's a way to run code which will change the criteria of a query from the query itself.
You'll most likely have to do it through a form.
I have in the past set this value to a text box, and then past that value into the query. Is this the only way to do it?
Rabbit 12,516
Recognized Expert Moderator MVP
As far as I know, yes.
Thanks for the help Rabbit, much appreciated.
Rabbit 12,516
Recognized Expert Moderator MVP
Not a problem. Glad to help.
NeoPa 32,579
Recognized Expert Moderator MVP
Looks more like the In Construct to me:
strPassSQL = "In(" & strSize & ")"
Try instead using : - strPassSQL = "In(" & Mid(strSize,2) & ")"
To lose the first ',' character.
NeoPa 32,579
Recognized Expert Moderator MVP
I have in the past set this value to a text box, and then past that value into the query. Is this the only way to do it?
It is also possible to set the SQL property of a QueryDef to match what you want.
Your code would have to be sophisticated enough to amend existing SQL.
Let me know if you're interested and/or want more detailed instructions.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: NK |
last post by:
Hi all,
Does anyone know of how I can disable case sensitivity for the LIKE
function in SQL?
Currently the SQL statement looks like:
$query = "SELECT * FROM itrader_games WHERE console='$console' AND
genre='$genre' AND title LIKE '%$title%' ";
|
by: Martin Robins |
last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being parsed can completely wreck it.
The string I am trying to parse is as follows:
commandText=insert into (Text) values (@message + N': ' + @category);commandType=StoredProcedure; message=@message; category=@category
I am looking to retrive name value...
|
by: joshsackett |
last post by:
I am starting an encryption project for my database and I'm performing
some tests on decryption speed. A lot of my application queries use a
LIKE parameter in the WHERE clause. To keep from changing my
application I am performing all the work on the back-end; creating
views, triggers and UDFs to encrypt/decrypt the data. A problem has
arisen around the LIKE parameter, though.
Currently:
SELECT SSN, FNAME, LNAME FROM USERS WHERE LNAME...
|
by: Dave Smithz |
last post by:
Hello there,
Summary:
How far can you go with SQL Select queries using like clauses with wildcard
characters. Can you apply anything like regular expressions?
Full details:
On a Intranet website, I request a code from a user which is then compared
with a code in an ADO access database.
|
by: S. van Beek |
last post by:
Dear reader,
How can I filter a numeric field with Like as criteria in a query.
To filter a numeric field with <10 as criteria this will com back with the
result of those records for which the value is smaller as teen.
But in case this value is variable and you prefer to work with "Like
| |
by: mosscliffe |
last post by:
I have been messing with the above all afternoon.
I must just be thick
I am using an AccessDataSource
I have tried modifying the select but I can not find the right syntax
to concatenate the LIKE part of the test by surrounding my textbox
field value with a leading and closing %.
|
by: Bruce Lawrence |
last post by:
Ok, I'm baffled...
I'm making a query in access 97 between 2 tables. There is a field in
both tables called "DWGNO".
OPENORD has a record with a DWGNO of "00000012345"
DIEDATA has a record with a DWGNO of "12345"
I'm not doing this with VBA right now. I'm doing it through the query
gui.
|
by: Drum2001 |
last post by:
Hello All!
I am using the following code during an On Click event for a button.
It works properly to create a query for a report:
Private Sub Command14_Click()
If IsNull(Me.Text30) Then
' No criteria here - so ignore
Else
strWhere = strWhere & ",'" & Me.Text30.Value & "'"
|
by: MLH |
last post by:
If I drop Like "*ABC*" in a QBE grid criteria cell,
the records returned include mixed case. Can I
force the uppercase limitation in a QBE grid?
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |