views:

223

answers:

2

Some of the queries I have written inside MS-Access are getting deleted automatically. And while I run the queries through code, I get this error

'Query should have one destination field'

What can be the possible reason

Explanation: I created a query in MS-access. Ran it from the code. Closed the database. Started it again, and now for that particular query, it is showing 'SELECT ;' only. Strange. I am in panic mode now

+1  A: 

Check if your query actually has any fields in the query design grid. When you open the query in design view, you will most likely notice it doesn't.

tehvan
It did have fields initially. Does it make any difference if I am using * instead of writing all field names?
Varun Mahajan
* should be fine, as it contains at least one field (provided your tables/queries are not all empty).
tehvan
A: 

Does the query stick around when you don't run the code (but still close and reopen the database)?

If so, I would suspect that something in your code is overwriting the query.

CodeSlave