Re: you canceled the previous operation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.



.



Relevant Pages

  • Re: Number format exception
    ... You need to fix your input file so it contains text which your parser ... Use split method of String class to ... binary data to the file. ...
    (comp.lang.java.help)
  • Re: Age Calculation
    ... The formula converts your date string into a DateTime type of variable. ... The best thing you could do would be to change the field type to a DateTime ... This could be a bit of work, since you may have to fix other ... >> I succesfully run a query calculating members age from a birthdate field. ...
    (microsoft.public.access.queries)
  • Re: Musing about yard sales, thrift shops and a corner of the barn.
    ... My grand dad has been able to fix anything broken with these and they work as good or better than original. ... Every barn and garage around here has a roll of baling wire (or even grass string) hanging on a nail on the wall to fix things that don't work anymore. ... Arch, old coffee cans are ready made boxes and until you pull the plastic lid off you don't know what you've got in them. ...
    (rec.crafts.woodturning)
  • Re: OpenForm with Where Clause
    ... So how would I do a pattern match on a field that had data like DMH10257 or ... Dim strWhere As String ... of unbound search controls on different types of fields, ... about the Like condition in the where clause? ...
    (comp.databases.ms-access)
  • Re: Clause order in SQL select query
    ... Rather than concatenate a bunch of string variables, ... '- since the FROM clause is parsed before the SELECT ...
    (microsoft.public.access.queries)