|
-
Jun 1st, 2002, 06:14 PM
#1
Thread Starter
Hyperactive Member
SQL Select Qustion :)
Hiya, here is some SQL:
SELECT Distinct Left$(Code, Len(Code) - 2) As CodeNum, O2, CO2
FROM Resin
WHERE (Right$(Code, 2) = " & cmbGoalTemp.Text & ")
AND (InStr(1, " & strresins & ", CodeNum, vbTextCompare) > 0)
I get this error: "No value given for one of more required parameters"
it's on this line:" AND (InStr(1, " & strresins & ", CodeNum, vbTextCompare) > 0)" im pretty sure because it worked before i added that.
the code field is full of values like this:
ax10
ax20
ax30
bc10
bc20
bc30
g110
g120
g130
and strresins looks like this: "ax,bc"
Can anyone tell me wat's wrong with it?
Thanks for your time
Ang
-
Jun 1st, 2002, 06:21 PM
#2
-= B u g S l a y e r =-
VB Code:
InStr(1, " & strresins & ", CodeNum, vbTextCompare)
looks all wrong... what is it that you want to do with this part. line of code?
-
Jun 1st, 2002, 06:24 PM
#3
Thread Starter
Hyperactive Member
I only want it to return the records thats code, well codenum, are in the strResin.
so if that database was
ax10
ax20
ax30
bc10
bc20
bc30
g110
g120
g130
and strresin was
"ax,bc"
and cmbtemp was 20
then i want to get the records ax20 and bc20.
does that make sense?
-
Jun 1st, 2002, 06:39 PM
#4
-= B u g S l a y e r =-
not 100% sure that the result of the SQL will be what u want it to, but this
VB Code:
InStr(1, " & strresins & ", CodeNum, vbTextCompare)
should be something like this
VB Code:
InStr(1, strresins, CodeNum, vbTextCompare)
it will return a nonezero val if CodeNum exists in strresins
-
Jun 2nd, 2002, 11:19 PM
#5
Thread Starter
Hyperactive Member
Yes yes, sorry, thats what i have, only it is passed during runtime as a record source, like this :
rstResins.Open "SELECT Distinct Left$(Code, Len(Code) - 2) As CodeNum, O2, CO2 FROM Resin WHERE (Right$(Code, 2) = " & cmbGoalTemp.Text & ") AND (InStr(1, " & "42014213" & ", CodeNum, vbTextCompare) > 0)" , , adOpenKeyset, adLockOptimistic
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|