DoCmd.OpenQuery

rexmorgan

Registered User.
Local time
Today, 05:17
Joined
May 31, 2010
Messages
47
So I have this simple database with different stations and precipitation data. I am attempting to create a dynamic query 'on the fly', so to speak, that uses a combo box to select a particular month from a table. There is a command button on a form with attached code. The code is supposed to take the value selected from the combo box and build the query titled 'MyQuery'. Once 'MyQuery' is built the idea is to then open the query with the option to plot the values in Google Earth.

Now I have something similar to this that is a spotter database. It includes all of the weather spotter in our area along with lat, long, etc. With the option to plot the names and phone numbers in Google Earth.

I cannot seem to figure out where I am going wrong here. The debugger stops on DoCmd.OpenQuery ("MyQuery"). If anyone has any suggestions it would be greatly appreciated. I am attaching my simple database for reference (Access 2007). Thanks in advance. :confused:
 

Attachments

There is a problem with your query that you are building so you need to fix that first.

Your first error is fixed by replacing DoCmd.OpenQuery ("MyQuery") with DoCmd.OpenQuery "MyQuery". Then you will get another error because of the problem with the SQL you are building.
 
First off thanks for the reply. I initially had that line as you suggested. In fact, I simply commented it out but otherwise left it there. But I still get the same error stopping on that line of code. Specifically the error I get is Run-time error '3270' Property not found.

Aside from that error however you indicated that if I successfullly changed that line I would end up with another error because of the query I am building. Could you point me in the right direction as to what the problem is and how I might fix it. Thanks again.
 
Sorry I do not have the time to decipher your query. Open up the query you have created in the design view and you will see the problem. Fix the query then go back to the code you are using to create the query and adjust as neccessary to fix your problem.
 

Users who are viewing this thread

Back
Top Bottom