472,353 Members | 945 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Macro to Run multiple queries


I know virtually nothing about creating Macros in Access.

I would appreciate some help in creating a Macro or Macros that
automatically run(s) 14 Queries (three Make Table Queries, and 11
Append Queries) when the Database is first opened, and then again
anytime I invoke the Macro (somehow) after the database is already
open. The latter function is useful, because the queries must be rerun
every time data is added, deleted, or changed.

Actually, it is a little more complicated than that, because when six
of the queries run, two dialog boxes pop up that need to be closed
before the query will run. (I know why this happens, but I am not sure
I know how to fix it just now.) Before the 13th Append query runs, two
fields need to be added to the table that was created by the 7th Make
table query.

As hobbled and awkward as this database is, it does seem to work, and
I have put a lot of time and effort into it, so I would like to get
these last bugs out.

If anyone is interested in the application, here is a not so brief

I have created a complicated (and poorly written, I'm sure) database
that helps me keep track of my clients' active securities accounts on
a fiscal year basis. Unfortunately, the monthly statements provided by
the investment banker are on a calendar year, not a fiscal year basis,
they do not summarize purchases, and they do not provide cost basis
information. The investment counselor insists on using that particular
broker anyway, much to my dismay.

So that I have the information summarized when I need it at tax time,
my staff enters dozens of transactions for each account every month
into the database. I have designed queries, forms, and reports that
show the portfolio at cost at the end of each month, the purchases for
the month, the gains and losses for the month, and that reconcile the
cash account each month, summarizing interest, dividends, etc.

The database is continuous, including transactions for multiple years.
The reason for this is so data entry clerks won't have to enter the
beginning of the year portfolio by hand every year. Instead, I can
change the fiscal year criteria in the various queries to isolate the
current year transactions.

One of the features of the form I created to enter the data allows the
data entry clerk to enter multiple sales of partial lots of securities
in the same record as the original purchase (or purchases) so that the
remaining cost basis and shares held are calculated automatically.
Without this feature, data entry clerks would have to calculate the
cost of the securities sold and remaining basis themselves, an
error-prone procedure. The benefit of this automatic calculation comes
at a price, though. It becomes very difficult to isolate transactions
that occur in one fiscal year when the various sale dates in any one
record span more than one fiscal year. I have created six separate
sales fields within each record, such as SaleDate1, NoSharesSold1,
SalesPrice1, SaleDate2, NoSharesSold2, SalesPrice2, through SaleDate6,
etc. In most cases, six is enough.

I have devised a method to isolate the various dates within each
record that uses one Make Table and five or six Append Table Queries,
one for each of the Sales fields, 1 - 6. This way, the query only
needs to look at one date field at a time and can eliminate dates that
fall outside the fiscal year. The table thus created is limited to
fiscal year transactions. SaleDate 1 through 6 are combined in the
table as SaleDate, and the same for NoSharesSold and SalesPrice, but
the transactions are kept separate in the table, not combined.

I actually have two sets of six Make Table / Append to Table Queries
with six and seven total queries each (and a third make table query to
make a total of 14 queries). One set helps to calculate gains and
losses and the other helps to calculate the portfolio (summary and
detail) at cost.

Thanks in advance to anyone who might be willing to help me out.


Nov 13 '05 #1
0 8479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn....
by: jallegue | last post by:
I am would like to get the list of queries that make a macro in MS-Access using vb 6.0.
by: italiak | last post by:
Hello everyone- I have these 500 queries in access. They all do the same thing (append data from big database to a table) and have similar...
by: Comcast Newsgroups | last post by:
I'm trying to put together a macro that queries my cell phone call expense DB the selects records as of a specific Date that are not marked...
by: skinnybloke | last post by:
Hi - I have 3 access queries which I run via 1 macro. Each of the queries now requires 2 parameters when they the run. The parameters are start...
by: doninsbca1 | last post by:
I want to start at the macro level (or query level) and document the queries, sub-queries, and tables that macro or primary query uses. I don't want...
by: swb76 | last post by:
Hi, I have 6 queries in Access that run great. They need to be run in sequence with the first 5 queries writing to tables and the sixth one pops...
by: todWulff | last post by:
Good day folks. Let me open with the statement that I am not a C++/C programmer. The environment that I am programming in is ARMbasic, an...
by: David Wright | last post by:
Hello Folks I have a Macro which consecutively opens seven ‘Make Table Query’s’. Each query requests two parameter inputs i.e. ‘Please Enter...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.