Re: you canceled the previous operation
- From: "Carl Rapson" <mr.mxyzptlk@xxxxxxxxxxxxxxxxx>
- Date: Mon, 6 Aug 2007 14:29:41 -0500
Under what circumstances do you get the error? From what you've posted, in
the case where no items are selected then your WHERE clause will look
something like this:
"WHERE NewTable.Flange_Type IN(NewTable.Flange_Type Like ' * ' );"
That's definitely not right. Can you set a breakpoint just after building
the SQL string and print out the string to see what it looks like?
Carl Rapson
"swordsman8" <swordsman8@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:798EF71A-9BBA-42C5-9E28-5B64B0BC9398@xxxxxxxxxxxxxxxx
How would I fix what I have for code. Is there something I have to do
with
strCriteria5 to make it work for a number field. Do I do something in the
IN() statement to make it understand that it is a number.
The code I have works fine with all the other code I have but when I use
it
here is craps out.
thank you,
Swordsman8
"SteveM" wrote:
Using Variant the way you have for inspecting the ItemsSelected
collection of
a listbox is perfectly valid and OK.
Looks to me like the problem is you IN() clause.
Unless there is some other code to build strCriteria5 it isn't valid at
the
point where you build strSQL.
Even if you do, I suspect that is the problem anyway...
I'd check the value of strSQL and make sure all SQL in the string is
valid
when used...
Steve
"swordsman8" wrote:
Hello Everyone,
I know what the problem is and even know how you would normally fix
this
problem. In this situation I cannot figure out the way to fix the
problem.
I get the above error message. First off yes everything is spelled
correctly. The Flange_Type is a number field. The Form uses a list
box so
that a user can select as many items as possible. The way I know how
to
write the code to do this makes the values in varients even though they
are
numbers. How can I write the code to work but that it will not give me
this
problem.
I am only putting in the needed code to fix problem.
Dim varItem5 As Variable
Dim strCriteria5 As String
If Me.listFlange.ItemsSelected.Count > 0 Then
For Each varItem5 In Me.listFlange.ItemsSelected
strCriteria5 = strCriteria5 & ",'" &
Me.listFlange.ItemData(varItem5) &
"'"
Next varItem5
strCriteria5 = Right(strCriteria5, Len(strCriteria5) - 1)
Else
strCriteria5 = "NewTable.Flange_Type Like ' * ' "
End If
strSQL = "SELECT * FROM NewTable " & _
"WHERE NewTable.Flange_Type IN(" & strCriteria5 & ");"
Thank you,
Swordsman8
If there is no way to do it I will have to fix the excel sheets and
change
the numbers to words.
.
- Follow-Ups:
- Re: you canceled the previous operation
- From: swordsman8
- Re: you canceled the previous operation
- References:
- RE: you canceled the previous operation
- From: swordsman8
- RE: you canceled the previous operation
- Prev by Date: RE: you canceled the previous operation
- Next by Date: Re: compile error - expected expression
- Previous by thread: RE: you canceled the previous operation
- Next by thread: Re: you canceled the previous operation
- Index(es):
Relevant Pages
|