473,729 Members | 2,189 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8776

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

Similar topics

699
34041
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
3
2439
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
9834
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 create a macro to modify the content of these queries. If the modify macro is not possible then I can delete the queries and try to create a macro which can create queries from scratch. Any help is appreciated.
5
2004
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 "Archive". I've worked out the Queries and the report and even got them into the macro but I can't figure out how to set up the Macro to prompt for ONE Date. Instead I get a prompt for the Select Query date and then again for the Update Query date. ...
9
35460
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 into the queries but on running the macro I have to enter each of the dates 3 times - once for each query. Is there an easy way to ask for the parameters once and for these to be passed onto each query?
0
1285
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 only, because then I have to go to each query used in the macro and document that, then go to each query or used in THAT query and document the queries or tables used . . . etc. Gives me a headache. I want: Macro 1 . . . query 1 . . . . . . ....
3
16222
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 can i automate this process? I started with the simple macro builder and entered all 6 queries perfectly fine. However, i want to prompt the user if they wish to run queries 1 & 2, if they say no, it should move to 3 and run the remaining ones....
1
3379
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 micro-controllers. So why am I posting herein? Well, the ARMbasic environment makes use of a tool borrowed from your folk's environment - CPP. The build details are: C:\Program Files\Coridium>cpp --version cpp (GCC) 3.2.3 (mingw special 20030504-1) Copyright...
4
3175
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 arduous answering each parameter request for the seven queries’s as the answer to each department code will be the same department code and the answer to every year will be the same year. (I may choose to enter a different department or a different year...
0
8932
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9163
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6028
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2702
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2173
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.