don't open Subfrom untill click on a tab

Bastiaan88

New member
Local time
Today, 21:49
Joined
Dec 3, 2008
Messages
5
Hi,

I have a problem with using a subfrom in a mainform. I made a query with a variable Criteria which has to be given when you open the query. From the query I build a form which gives a nice view on the results of the query. So when you open that form, you have to give the variable Criteria for use with the query. That's oké, but now

I made a mainform with different subforms in it, under which the form with the variable Criteria, but when you open the mainform it immediate asks for the variable Criteria, before even showing the other forms.
So I would like to know if it is possible to open the mainform without him asking for the variable Criteria until you click on the tab that belongs to the subform with the variable Criteria.

I hope someone can help me, because I did not find something usefull yet... And I am using Access 2003.

With kind regards,
Bastiaan
 
I'm not skilled and use 2000 so others will help you better. Could you set a default in the criteria so that it has a starting point? Also you could hide the subform while it has this default criteria and then show it from the AfterUpdate of the criteria field.
Mike
 
Mike, thanks for your suggestion, but I tried to hide the subform and show it from the AfterUpdate, but it still keeps asking for the variable criteria..

But do you know how to set a default criteria and then change that criteria on demand? Like change it on click or something. Is that possible?

Thanks in advance
Bastiaan
 
Bastiaan
I would be happy to help you but it is difficult without knowing more about your problem. I am a little confused when you say "from the query I build a form". Do you mean "I use a query as the data source of a form"?
I often put a text box on the main form that controls the content of a subform so I guess this is similar. The query for the sub includes the criteria... Like "*" & [Forms]![MainMenu]![Search2] & "*" ...in the grid. When the main form opens, Search2 is empty so all records appear but when that control is changed, the sub is requeried.
If you are still struggling, you could either strip out anything not important and post a zipped copy for me to see and hopefully fix or give me some more information about the problem.
Good luck, Mike
 
Mike,

Thanks for your help so far, I understand that it is hard to understand without having an example, so I made a small example version of the thing I am trying to get working, so I hope it will be more clear...

A little explanation about it, when you click on forms, there are 3 forms, 1 mainpage, 1 for a view of all the results and 1 for a view of the results with criteria you have to give when opening the form.

What I would like to achieve is that you can open the mainpage without having to enter the criteria for the 3th form untill you click on the tab which belongs to the 3th form on the mainpage...

I hope it is more clear and you can help me further, otherwise I would love to explain it further for as far as it is possible. By the way, it is made with Access 2003...

Bastiaan
 

Attachments

Bastiaan
Thanks for posting the zip. As I said, I prefer to use Access 2000 but I do have 2007 so I have opened it in that. I am a little tied up with a TabCtl problem of my own at the moment but I think I can see what you are trying to do so I will create a small app and post it soon. It will be in A2k but you will be able to open it in 2003.
Mike
 
Mike,

Thank you very much in advance for trying to help me! I am really looking forward to you app!

Bastiaan
 
Hope the attached helps. You would not be able to open a 2007 version so I have made it in 2000 and you will need to convert it to 2003.
I have used a query because you did, I usually put the query sql directly in the Record Source of the sub.
Mike
 

Attachments

Mike,
Thank you very much for the example, it was really helpful and exactly what I was looking for! So I am going to try it for myself and use it in my app. Thanks again!
Bastiaan
 

Users who are viewing this thread

Back
Top Bottom