473,320 Members | 2,020 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,320 software developers and data experts.

How to open queries in subforms?

Hello,

I have four different queries based on the same table. I would like to open them in a subform using four different button clicks (each query has its own button). How can this be accomplished?

I tried but it doesn't work could I please get an overview of how it can be done?

Private Sub Cmd9_Click()
data_window.Visible = True
data_window.SourceObject = "RECENT RECORD"
Label7.Visible = False
Label8.Visible = False
End Sub
Oct 3 '07 #1
1 1135
Jim Doherty
897 Expert 512MB
Hello,

I have four different queries based on the same table. I would like to open them in a subform using four different button clicks (each query has its own button). How can this be accomplished?

I tried but it doesn't work could I please get an overview of how it can be done?

Private Sub Cmd9_Click()
data_window.Visible = True
data_window.SourceObject = "RECENT RECORD"
Label7.Visible = False
Label8.Visible = False
End Sub

The subform can be altered to have the source object forms recordsource changed to any one of those queries at runtime and display the resultset

If you are specifically wishing it to be four separate command buttons then in the ON_CLICK event of each command you need code like this

Me!NameOfSubform.Form.RecordSource="NameOfYourQuer y"


(personally I'd use an option group or toggle buttons that way the user is visually aware of which recordsource the subform is hooked up to and with a fifth option 'None' to make the subform either invisible or replace the source object with a surrogate form that merely has a label mounted on it telling the user to select an option from the option group - something like that - your design choice though)

Regards

Jim
Oct 5 '07 #2

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

Similar topics

1
by: John | last post by:
(acc2002) I have a command button (cmdView) on a form (frmOverview)that needs to open a form (frmFilmProjectAgreements) and its two subforms (control names: fsubAgreements and fsubPayments)...
6
by: Debbie Gilbert | last post by:
When running a report..I get the message "Cannot open any more databases." Run-time error 3048... Has anyone seen this message before?
2
by: Jonathan LaRosa | last post by:
Hi all - I'm wondering if anyone has (or knows of) a tool that will allow me to search through VB code, tables, queries, reports, forms, and other objects, for references to all other types of...
3
by: Paolo | last post by:
Friends, My database has 5 different tables (tbl1, tbl2, tlb3, tbl4, and tbl5) with the same fields: ID, SSN, LNAME, FNAME, RECEIVED and CLOSED. The ID is the PK and its autonumber. Obiously...
1
by: Phil Stanton | last post by:
Real problem usink AK2 I have got a form with 7 tabs on it, numerous subforms and combo boxes. as well as continuous subforms with combo boxes. I get the message "Can't open any more databases"...
6
by: ultraton | last post by:
While trying to print a report from Access the user receives the following error: Cannot open any more databases. Okay Help Does anyone have any ideas about this behavior? Thank you very...
0
by: bhipwell via AccessMonster.com | last post by:
I am getting the 3048 error: "Cannot open any more databases." I have a couple forms loaded with tabs covered in combo boxes, list boxes, etc. The error occurs when running a form with 12...
2
by: helpmeplease213 | last post by:
Hello, I have four different queries based on the same table. I would like to open them in a subform using four different button clicks (each query has its own button). How can this be...
2
by: Bob Alston | last post by:
Any straightforward way to open a form with multiple subforms, where the main form and all subforms are opened in readonly status? If I run docmd.openform.......,acreadonly the main form is...
3
by: louisjones | last post by:
Hi all I have a form with a few subforms. I want to set the subforms to 'not visible' and open each in an individual popup window from command buttons. If anyone knows a better way of opening...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.