Query String Too Long

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

Hi,

I have the following query:

Like [forms]![report selection]![program1b] Or Like
[forms]![report selection]![program2b] Or Like [forms]!
[report selection]![program3b] Or Like [forms]![report
selection]![program4b] Or Like [forms]![report selection]!
[program5b] Or Like [forms]![report selection]!
[program6b] Or Like [forms]![report selection]!
[program7b] Or Like [forms]![report selection]!
[program8b] Or Like [forms]![report selection]!
[program9b] Or Like [forms]![report selection]!
[program10b] Or Like [forms]![report selection]!
[program11b] Or (Like [forms]![report selection]!
[program1copy] Or Like [forms]![report selection]!
[program2copy] Or Like [forms]![report selection]!
[program3copy] Or Like [forms]![report selection]!
[program4copy] Or Like [forms]![report selection]!
[program5copy] Or Like [forms]![report selection]!
[program6copy] Or Like [forms]![report selection]!
[program7copy] Or Like [forms]![report selection]!
[program8copy] Or Like [forms]![report selection]!
[program9copy] Or Like [forms]![report selection]!
[program10copy] Or Like [forms]![report selection]!
[program11copy])

BUT when I go to close the design view of the Query, it
says that the query string is too long. Is there any
other way I can write this because this query is
basically what I need? BTW this query is for a graph
within the report.

Thanks in advance,
geebee
 
You could have a sepearate table with listing your
"program..." and add a second field(GroupId) with the
grouping. Give the same groupID to all the dewsired
program... Add this table to the query and join at the
Program name. The select GroupID = Mygroup

Jim

Add this tab
 
According to Help, the number of characters in a cell in the query design
grid = 1024

Since you aren't using any wildcards, you could get rid of every "Like" in
the criteria, which will get rid of about 125 characters. That might be
enough to do it.

Of course, the real solution would be to design the database without the
repeated fields.
 
Well, you could shorten this using an in clause assuming that you are not using
any wild card characters in your controls.

IN ([forms]![report selection]![program1b],
[forms]![report selection]![program2b],
[forms]![report selection]![program3b],
....
[forms]![report selection]![program10copy],
[forms]![report selection]![program11copy])

A better solution might be to build a table with the values and then use a join
to the table in your query. I've seen that suggested else thread.

Also, you could cut the length by changing the name of the form from "Report
Selection" to "rptSelect". That change would save you 7 more characters each
time you needed to reference the form.
 
Back
Top