473,503 Members | 13,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Query Result to a Form or List

16 New Member
I have a form in MS Access where I enter a value (I'll call it Value_A) that is then passed to multiple queries. After the queries run, the results of the final query are exported to a .csv file for import into another program.

To summarize my workflow: 1) I enter a Value_A into a field in Form1, 2) I click a button in Form1 that initiates an event where Value_A is passed to a series of queries (using an On Click Event sub procedure with DoCmd), 3) the results of the final query are exported (within the same sub procedure), and I enter the next Value_A and start again.

I have about 400 values of Value_A to enter. Is there an easy way to pass all the values of Value_A through the subprocedure or to the field in the form? I can query all values of Value_A or put them into a table.

My apologies if my description is somewhat confusing.
Mar 20 '14 #1
8 1492
zmbd
5,501 Recognized Expert Moderator Expert
query all values of Value_A or put them into a table
- To make sure I understand, all of the data for "Value_A" are already in the database ?

If this is true:
Then I would take your current code and alter it slightly so that we open a DAO record-set on your field with all of your "Value_A" and then step thru this record-set feeding the returned value into the current code so that the queries are ran.

This could be done in a new form so that your current form need not be altered, or we could even just add a button to the current form that will fire the batch off.
Mar 20 '14 #2
birdDBheadache
16 New Member
Yes. That is correct. All the data for Value_A are already in the database. Right now I just query it and then enter it manually (which seems like a waste of time). So stepping through each value is exactly what I need to do.
Mar 20 '14 #3
zmbd
5,501 Recognized Expert Moderator Expert
I can NOT stress this enough... DO NOT WORK ON THE ORIGINAL FILE nor the PRODUCTION FILE.

You can either use the Operating system or Access to make a copy of the file, add "backup_" to filename,(Using the OS you might need to remove "copy of" if its there).
Make a second copy of the file, remove "copy of" and add "dvlpmnt_"
dvlpmnt_ will be the file you play with... if Access crashes, no big deal, if you trash something close; then, you can use the operating system to copy backup_ and save as the dvlpmnt_ starting from scratch.

This should be easy enough for you to do, depending on your VBA background. I've already given you the basic outline; thus, you need only decide which way to go, new form (if the database is not split AND there are no other values being pulled from the exsiting form - my choice), new command button (if the database is split OR there are other values being pulled from the form), or alter the current command button (not my choice in either case).
Mar 20 '14 #4
birdDBheadache
16 New Member
I don't have much VBA background, but I can do fairly basic things. I like the idea of using a new form, but I am flexible. If you can show me an example of how to step through each record and pass it to the query, I think I can pretty easily apply it to my existing database.
Thanks for your help.
Mar 21 '14 #5
NeoPa
32,557 Recognized Expert Moderator MVP
Access VBA DAO Recordset Loop Using Two Recordsets gives some example recordset processing code. It handles two recordsets so may be more complex than you need, but it should cover that.
Mar 21 '14 #6
birdDBheadache
16 New Member
That worked! Thanks! I was even able to use my existing form with only minor tweaking.
Mar 21 '14 #7
zmbd
5,501 Recognized Expert Moderator Expert
Thnx Neopa!

teach me not to read all of the insight articles... at least I was on the right path!

(^_^)
Mar 23 '14 #8
NeoPa
32,557 Recognized Expert Moderator MVP
There was nothing amiss from your post Z. I merely added some flesh to what you'd already explained.

PS. Hit me up if you'd like a copy of my Bytes DB which stores links to all the articles I've felt to be important. I can think of no better expert to make use of it as you post so fully and frequently.
Mar 23 '14 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2324
by: Jack | last post by:
Hi, I have a form when loaded, retrieves record from an access table. Among other fields there is a check box called FinalUpdate. This is tied to a field in Access of type Yes/No. The form...
2
4144
by: William Wisnieski | last post by:
Hello Everyone Access 2000 Looking for some suggestions and advice on how to proceed with this. I hope its not as complicated as it seems to me right now. I've got an unbound main form...
1
1988
by: Craig M | last post by:
Hi, I've created a query that has all calculations needed, and made a report based on this. I have then made a form based on this query. What I would like to do is print only the current...
4
3509
by: Theo Jansen | last post by:
Hi, i'm making an application in Access and in the query made, i'd like the user to fill in a parameter when opening the query (in a report). It's much easier for the user if the parameter was a...
1
2577
by: RookieDan | last post by:
Greetings fellow Accessers! Im new but in Access, but I have some background in different coding. I have a programme loading customer data into Access belonging to BMW dealers in Europe. ...
0
1271
kcdoell
by: kcdoell | last post by:
Hello: I have a form that I am using to help me display a query that I have built. On that form I have multiple combo boxes that I have called cobMonth, cobYear, cobWorkingRegion, etc......
3
1273
by: Andrus | last post by:
For paged data access I need to convert result of DLinq query to something (list or array) which can be accessed by integer index. I use for this metod below. Is it best solution to use foreach...
2
3295
by: reeba | last post by:
I want to store the query result, in an servlet, into an xml file and display the contents of the xml file on the browser...... my code is as follows: public void doPost(HttpServletRequest...
1
2069
by: urfriend | last post by:
Hi, I have a multiple search form, and when I use it, it displays the result according to the criteria given in that form. However, the result is shown in datasheet view as a query result. How can...
0
7213
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
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
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...
0
5610
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,...
1
5026
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...
0
4698
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.