473,722 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get a query to pick up the value of the active form

Here is the situation: I have a main form with lots of tabs. The
first tab has a subform with a lot of tabs.

Each of those tabs has 1 subform. That subform contains an ID. So
subsubform1 has an ID, subsubform2 has an ID up thru subsubform40. The
ID on every subform is named exactly the same thing: intID.

I need to put a button on each subsubform. That button opens another
form based on the intID of that particular subsubform.

I would prefer to have one form open up from the subsubform. Do I
change the recordsource of the new form each time I open it? Is there
a way I could write the query to recognize the ID of whatever
subsubform the user is on?

Any ideas?

Thanks in advance,
Laura

Nov 13 '05 #1
2 1622
On 7 Sep 2005 18:57:41 -0700, "musiclover lch" <lh****@gmail.c om> wrote:
Here is the situation: I have a main form with lots of tabs. The
first tab has a subform with a lot of tabs.

Each of those tabs has 1 subform. That subform contains an ID. So
subsubform1 has an ID, subsubform2 has an ID up thru subsubform40. The
ID on every subform is named exactly the same thing: intID.

I need to put a button on each subsubform. That button opens another
form based on the intID of that particular subsubform.

I would prefer to have one form open up from the subsubform. Do I
change the recordsource of the new form each time I open it? Is there
a way I could write the query to recognize the ID of whatever
subsubform the user is on?

Any ideas?

Thanks in advance,
Laura


Hi
In the onclick event of the button on each subform, open your "one form"
using the openargs argument to pass the value of intID:

DoCmd.OpenForm formname,,,,,,I ntID

then in the Open event of the form set the recordsource, eg

Private Sub Form_Open(Cance l As Integer)
dim sql$, intID&
intID = me.Openargs 'note this is actually a string
....code to set sql depending on the value of intID
Me.Recordsource = sql
End Sub

Alternatively if you can express all the recordsources you need as just one query
which uses the value of IntID as a parameter, you could store the value of the
local intID in some public variable in a standard module as part of the button click event,
and use that value in the sql of recordsouce via a public function.

(Or even use the official parameter mechanism,if you understand how to do it)

Nov 13 '05 #2
An idea, but not mine:

Simplicity is the soul of efficiency.

-Austin Freeman
(The Eye of Osiris)

Nov 13 '05 #3

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

Similar topics

13
2888
by: dogu | last post by:
Noob alert. Code is below. File is saved as a .php. What I'm trying to do: User uses 'select' box drop down list to pick a value. Value ($site) is derived from a db query. This works fine. Value selected is used as the 'where' clause of the 2nd query. If $site is a single word, the 2nd query works like a charm. If $site is more than one word (has spaces), the query returns a null
1
518
by: Giulio | last post by:
Hello, I have a continuous form with a combo box inside. From the combo box I can pick some values which, by the "after-update" event, change some other combo box values determined by a query. (i.e. I have some tree names and depending on what tree I pick on the other combo box I can pick its fruits and other properties) Now, mine is a continous form, and whenever I pick a value from the first combo box the second one correctly shows...
1
291
by: Michelle | last post by:
I have took another approach to my database and have created a field in my clients table with a 'client status' field, which is a combo box/value list that is a pulldown menu of 3 choices (active client, possible client, completed client). I want to be able to create 3 different queries that will produce a list that will only publish clients that are active, possible, etc... (according to whatever the field value is of their status). I...
4
8173
by: uspensky | last post by:
I have a table (cars) with 3 fields: VIN, Class, sell_price 101, sports, 10000 102, sports, 11000 103, luxury, 9000 104, sports, 11000 105, sports, 11000 106, luxury, 5000 107, sports, 11000
2
8079
by: Zeljko | last post by:
I'm creating Address book. Header of the main form (frmAddress) contains combo box (cboFilter) to filter records by Occupation on main Form(Ocupation1). That's working. Combo box also have "Show All" in one row. ==Combo box query: SELECT tblOCUPATION.id, tblOCUPATION.txtOcupation1 FROM tblOCUPATION UNION Select "(All)" as Bogus, Null as AllChoice From ; ==Combo box event: If IsNull(Me!) Then
5
2938
by: Kaspa | last post by:
I am creating a contact database and I would like the user to create his own groups of contacts based on criterias, thefore I would like to let him pick the fields and criteria for a particular group. I don't wanna a form full of fields that ask the user for arguments. Instead a subform with a combobox where the user picks the , the , and the So I would have two tables groups and GroupCriteria for instance: group field ...
1
3884
by: Regnab | last post by:
I've got a form where the user can edit the lookups available in the database. It consists of a list box of the various categories on the main form, a checkbox on the main form and a sub form which displays the lookup values in a datasheet format. When a lookup values is no longer current, the user can untick the "Active" box in the datasheet and it will disappear (requeries the subform's recordsource query). On the main form, I have the...
5
1927
by: talktozee | last post by:
Hello, everyone! Here's are the basics: 1. The query looks at all positions that are active and haven't been filled. 2. It then has to look at every single position and determine three things: Does the person running the query (via an ASP page) have certain rights? a. Recruit rights b. Enlist rights c. Take rights
6
7034
by: jmarcrum | last post by:
Hi! I have created a Union Query in ACCESS 2003, that combines 130 records from one query (Extra Foreman Radios) and 250 records from another query (Forman Main Radios). I have created a continuous form and used the Union query (qryRadioDataUnion) as my record source. My question is...how would i apply a filter to that query record source to allow the user to limit the search results down to an individual contractor, radio type, SIM card...
0
9386
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9090
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
8059
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
6685
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
4503
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
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3208
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 we have to send another system
2
2606
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2148
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.