473,486 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How To Set A Variable Like [acc] From Another Query?

2 New Member
Hi, this is literally driving me mad, to me it seems the simplest thing in the world to do but I have found absolutely no way of doing it.

Simply put I have a query which i'll call Query1 where it asks for input in the form:

[ACC]

I also have another query that uses Query1 for its information. How ON EARTH do I pass a variable to Query1 for [ACC]. It pops up with a textbox everytime but I don't want that, I want it to be filled in automatically with a value I give it. Something simple like [ACC]="RB123456" but nooooooo that does nothing.

I have absolutely no idea how to continue. I've literally been looking how to do this for the past 2 hours. Some advice please.

TIA
Jan 5 '07 #1
6 1633
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi, this is literally driving me mad, to me it seems the simplest thing in the world to do but I have found absolutely no way of doing it.

Simply put I have a query which i'll call Query1 where it asks for input in the form:

[ACC]

I also have another query that uses Query1 for its information. How ON EARTH do I pass a variable to Query1 for [ACC]. It pops up with a textbox everytime but I don't want that, I want it to be filled in automatically with a value I give it. Something simple like [ACC]="RB123456" but nooooooo that does nothing.

I have absolutely no idea how to continue. I've literally been looking how to do this for the past 2 hours. Some advice please.

TIA
You have to keep the form open that populates the [ACC] value in query1 while running query2.

Mary
Jan 6 '07 #2
byb3
2 New Member
Hi thanks for your reply, its much appreciated.

The problem is I don't know how to populate the [ACC] variable. I can only put data into this variable when it pops up as an inputbox. I can't pass information to it from another query. Simply put I would like to be able to set the [ACC] variable in query2 to a value say 'RB123456', which would then be sent to query1, without the inputbox popping up.

The way the database is set up, I have a query which takes information from a very large database of billions of records. I then run a second query on this query. Supposedly I could merge the two queries into one but it would over complicate things and give me a giant bit of SQL code.

How do I skip the inputbox stage and have the query fill in this box automatically. Or do I have to use a global string or another method?

At the moment I'm not using a form but I will be eventually. How do I solve this using just a query?

Thanks in Advance, I appreciate you spending your own time in offering your advice.
Jan 7 '07 #3
willakawill
1,646 Top Contributor
Hi thanks for your reply, its much appreciated.

The problem is I don't know how to populate the [ACC] variable. I can only put data into this variable when it pops up as an inputbox. I can't pass information to it from another query. Simply put I would like to be able to set the [ACC] variable in query2 to a value say 'RB123456', which would then be sent to query1, without the inputbox popping up.

The way the database is set up, I have a query which takes information from a very large database of billions of records. I then run a second query on this query. Supposedly I could merge the two queries into one but it would over complicate things and give me a giant bit of SQL code.

How do I skip the inputbox stage and have the query fill in this box automatically. Or do I have to use a global string or another method?

At the moment I'm not using a form but I will be eventually. How do I solve this using just a query?

Thanks in Advance, I appreciate you spending your own time in offering your advice.
Hi. You need to post code for this. In particular we need to know both queries without abbreviating them even if you think that part of it is not relevant.

When you are looking at query design mode go to view sql and paste the text here
Jan 7 '07 #4
nico5038
3,080 Recognized Expert Specialist
Did you try to use a subquery like:

SELECT A.*
FROM tblX A INNER JOIN (select B.* from tblY B where B.ID=[ACC]) ON tblA.A = B.A;

Just replace the present queryname with "(", the SQL text from query and ")"

Nic;o)
Jan 7 '07 #5
pks00
280 Recognized Expert Contributor
If u have a form which takes input for ACC, how have u defined your SQL?

Did u do [ACC] or did u reference the form?

i.e.

forms!nameofmyform!ACC
Jan 7 '07 #6
NeoPa
32,556 Recognized Expert Moderator MVP
An intriguing question - and sorry to give you more replies to respond to but,
How are the two queries (#1 & #2) related?
Do you want to call (refer to) #2 from within #1?
Or maybe you want to call them one after the other from some code?
Do you have a form from which they will both be called?
These are important bits of information which will effect the answer as there are many possible answers depending on what the question actually is.
I always recomment answering ALL requests for information, but I will await you response to mine :)
Jan 7 '07 #7

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

Similar topics

3
2214
by: Paul Sheer | last post by:
I have managed to build Python 2.3.3 with the aCC HP-UX C++ compiler by making a number of one-line changes. (For reasons beyond my control, I am forced to use this compiler and it has no C mode...
1
5099
by: Hermes | last post by:
Hi all, I'm using bind variables in sql in some asp pages, but something strange is happening with a few of the pages. I'm trying to add a bind variable to do an arrange and order of the output....
10
2971
by: vd12005 | last post by:
hello, i'm wondering how people from here handle this, as i often encounter something like: acc = # accumulator ;) for line in fileinput.input(): if condition(line): if acc: #1...
3
2739
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
0
6964
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...
1
6842
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
7319
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
5430
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,...
0
4559
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
3069
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
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 ...
0
262
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...

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.