Query by Form "blows-up" when query is closed and re-opened

K

Kodawari

I am having a major problem with a “query by form†“blowing upâ€. I am using
the following query on the criteria line:
[forms]![Q&A data query]![carrier] Or [forms]![Q&A data query]![carrier] Is
Null
Everything works just fine and the results are totally as predicted. Then,
I close the query (after saving it) and re-open it in “design viewâ€. The
results are the query statement has been separated at the “or†and the later
half deposited into the next field incomplete. This causes the query to
fail. On a form with many fields, it is a giant mess and Access cannot even
open the query any longer.
I am not proficient in SQL, but upon recommendation of a colleague, took a
look at what was happening in SQL before and after these events. By looking
at the SQL it is quite obvious something is going wrong. The following is a
before and after look at the SQL statements:
Before:
SELECT [Issues Prime Data].[name & IATA]
FROM [Issues Prime Data]
WHERE ((([Issues Prime Data].[name & IATA])=[forms]![Q&A data
query]![carrier] Or [forms]![Q&A data query]![carrier] Is Null));
After: SQL created for a field I did not even specify:
After (field one – left side)
SELECT
FROM [Issues Prime Data]
WHERE ((([Issues Prime Data].[name & IATA])=[forms]![Q&A data
query]![carrier])) OR ((([forms]![Q&A data query]![carrier]) Is Null));
After (field two – right side)
SELECT
FROM [Issues Prime Data]
WHERE ((([Issues Prime Data].[name & IATA])=[forms]![Q&A data
query]![carrier])) OR ((([forms]![Q&A data query]![carrier]) Is Null));
The only action I performed to receive this result is closing and opening
the query.
Is this a known issue with Access prior to SP2? My company has not
installed SP2 yet.
Hoping someone out there could help solve this problem.
Thanks.
 
D

Daryl S

Are you trying to limit the query to the value on the form unless this value
is null?

If so, use the criteria [forms]![Q&A data query]![carrier] under the
field for the case where it matches the value on the form. For the case
where the form field is null, add a new column to the query for the 'field'
[forms]![Q&A data query]![carrier] and under this new field, on a separate
criteria line, enter "Is Null". (You can uncheck the box so this new field
won't show up).

If you have criteria for other fields, those criteria need to be copied down
to this other new criteria row.

Daryl S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top