Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query doesn't work right when run from a macro?

Status
Not open for further replies.

fioracasey

Programmer
Jun 30, 2001
13
0
0
US
I have set up several queries that run one after another.

1st macro imports an excel spreadsheet
2nd macro selects certain data and makes a temp table
3rd macro selects the temp table and another table from the database and combines it into a new temp table.

When I run them one at a time by clicking on them, they run fine. But, when I run them from the macro, it appears that the 2nd macro is is duplicating the data that it is grabbing. I don't understand it. I am sure that they worked correctly from the macro when I first created it.

I am using OpenQuery, view is datasheet and datamode is edit.

Any ideas? Thanks.
 
Via Tools/Macro I would convert the macros to VBA.
In VBA it would be much more easy to follow exactly what is happening during the run.
 
Herman is absolutely right: you need to abandon the use of macros.

Here some more arguments (from the ACCESS ONLINE ENCYCLOPEDIA at )
Article Code: G2

Why should you avoid MACROS ?
Macros have been a great invention back in 1987. In simply recording the operations on the screen any user could create his own little programs and modify them later on.
They are ideal if you just need one functionality and if you do not want to create a real application.
Nethertheless the creation of macros requires time and effort and there is a great chance that all this investment will be lost very soon.
The reasons are multiple:

Macros do not allow any error trapping
Macros can not be debugged
Macros are inflexible
Macros are not protected in MDE files
Related topics in the USA ACCESS ENCYCLOPEDIA:
All articles in the MODULES AND VBA section.

Exceptions from the rule

The AUTOEXEC macro will be executed automatically on opening your application
The AUTOKEYS macro can check the function keys throughout the whole application
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top