473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Macro to Run multiple queries

Hi,

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
summary.

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.

MHenry

Nov 13 '05 #1
0 8714

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

Similar topics

699
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. But, Python does not a have very good macro...
3
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.
4
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 condition. I was wondering if there is a way I can...
5
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 "Archive", prints a report, then marks the records...
9
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 and end dates. I have built the parameters...
0
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 to have a documenter that goes down one level...
3
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 up the final results in datasheet view. Now, how...
1
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 embedded BASIC targeted toward ARM-based...
4
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 Department Code’ and ‘Please Enter Year’. It is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.