run query in the background

paulevans

Registered User.
Local time
Today, 23:23
Joined
Mar 7, 2006
Messages
79
Hi

I am looking at being able to run a query but would like the results not to be displayed. Ie I would like the query to run in the background. I open the query using a command button from a form.

thanks for any help

Paul
 
Is this some kind of action query that you need to run? I think I would use the DoCmd.RunSQL action...
 
Thanks

This looks as it may be the way I need to go. Im a little new to all this and at some point I need to convert my Database to sql server. The query I have at the moment checks on a field called postcode and depending on the value ie if there is any information or not then it the query updates a new coloum called pc the sql statement from query is:

SELECT Table1.name, Table1.age, Table1.telephone, Table1.address, Table1.postcode, IIf(IsNull([postcode]),2,1) AS PC
FROM Table1;

how do I convert this to runsql.

also the following query:

SELECT qry1.name, qry1.age, qry1.telephone, qry1.address, qry1.postcode, tbl3.ImageBMP
FROM qry1 INNER JOIN tbl3 ON qry1.PC = tbl3.ImageID;
 
I'm not sure that the method you are employing (as a whole) is the best way to go, but as far as the RunSQL, I would think something like the following would work:

Code:
dim mySQLString as a string

mySQLString = "SELECT Table1.name, Table1.age, Table1.telephone, Table1.address, Table1.postcode, IIf(IsNull([postcode]),2,1) AS PC
FROM Table1;"

DoCmd.RunSQL mySQLString
 
Hi Ken

Thanks for pointing me in the right direction. Only my query was a selct query and does not work in a action satement. However ran this through a list box and works brill.

Thanks for your help.
Paul
 

Users who are viewing this thread

Back
Top Bottom