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 3368
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?
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?
As far as I know, yes.
Thanks for the help Rabbit, much appreciated.
Not a problem. Glad to help.
NeoPa 32,556
Expert Mod 16PB
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,556
Expert Mod 16PB
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.
Why not create a table with the 150, 151, 180, 181, etc. values in a row and an additional checkbox.
Thus you can let the user check the rows in a datasheet subform and all needed is to join this additional table by the code to this table and add the criteria "True" for the checkbox.
Saves the code and you could use a simple UPDATE query to set/reset the checkbox on the form.
Idea ?
Nic;o)
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
| |