473,387 Members | 1,520 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,387 software developers and data experts.

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 1605
On 7 Sep 2005 18:57:41 -0700, "musicloverlch" <lh****@gmail.com> 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,,,,,,IntID

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

Private Sub Form_Open(Cancel 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
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....
1
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....
1
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...
4
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
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...
5
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...
1
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...
5
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...
6
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.