By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,819 Members | 1,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,819 IT Pros & Developers. It's quick & easy.

How to open a sub form with command button

P: 1
I have a Search form "SearchF" with 2 fields Equipment # and Location.

I build the query "SearchQ" with criteria
Expand|Select|Wrap|Line Numbers
  1. (Like "*" & [Forms]![SearchF]![Equipment #] & "*")
and
Expand|Select|Wrap|Line Numbers
  1. (Like "*" & [Forms]![SearchF]![Location] & "*")
Then I built the form "SearchQF"

The search button is in the main form. I have the sub form "results". The command works great using vba
Expand|Select|Wrap|Line Numbers
  1. Private Sub Searchbar_Click()
  2. Me!Results.Form.RecordSource = "SearchQ"
  3. End Sub
The only thing is I do not want to see the sub form when I open the search form (datasheet view). I want the sub form hidden until I hit the search button in the main form.

Can anyone help?
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


NeoPa
Expert Mod 15k+
P: 31,470
You have two main options :
  1. Make the SubForm Control (That is a Control and not the form itself.) invisible.
  2. Set which Form is used in the SubForm Control only when you want it to be viewed.
3 Weeks Ago #2

Post your reply

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