Subform Query

Saifon

Registered User.
Local time
Today, 01:42
Joined
Mar 7, 2005
Messages
11
I'm relatively new to visual basic, and not sure how to do this one, was wondering if anyone can help.

If you can take a look at this screenshot

ole0.bmp


Basically, what I'm looking to do is, when someone clicks on either command button, then the unbound subform will display a datasheet of the table in which the information is looked.

I have a table and ran 2 query's on the table.. One for showing all records with the department "Admin" and one to show all records with the department "Collections".

So when clicking on the command buttons, it shows these query's in the subform.

Was wondering what code to put behind the buttons to do this. Or even if there is any easier way to do what I'm looking for.. I will have about 10 departments, and each button will run a query, is this the best way to do this. ?
 
Saifon,

Putting something like the following in onclick of the buttons should work:
(Of course, the stuff starting with 'my...' will need to be changed)


Code:
forms!myMainForm!mySubform.form.recordsource = "MyQueryName1"
 
Hi

Thanks.. but can't quite get the code to work, The form I am using has tab controls on it.. so I need to select the subform on a specific tab

I get the Error "The Expression you entered refers to an object that is closed or does'nt exist."
 

Users who are viewing this thread

Back
Top Bottom