Pop up form ro run report

Hayley Baxter

Registered User.
Local time
Today, 17:32
Joined
Dec 11, 2001
Messages
1,607
I am new to pop up forms basically I want something simple. I want to select a report preview cmdbutton then my pop up form would appear asking for the contract type, enter this ie maintenance then up comes the report with all the maintenance contracts.

I have created a form with an unbound text box and 2 cmd buttons ok and cancel. I have the folloing criteria in my query which wrks however I want to say "Enter Contract Type"

NOT THE FOLLOWING CRITERIA IN MY DIALOUG BOX

=[Forms]![SubFrmSearchContractDetails]![Contract Name]

So now that I have set up this form I will obviously have to set code behind my cmdbutton for previewing the report to open my pop up frm but what do I then need to do so that I can tell the form that's the criteria I want it to look for then bring up the report? I suppose I will have to put code behind the Ok button to open the report it's just where do I put the criteria??

Many thanks
 
Sounds like you have the basic set up so far. Form gets the info, calls query that runs using that info, which opens a report to display the gathered info. What it sounds like is your form is unloading before the query actually runs, which is why the query starts with =[Forms]![SubFrmSearchContractDetails]!
[Contract Name] (I assume ContractName is the textbox on the popup form)
a good trick is to make the popup invisible instead of closing it. the textbox can then be referenced like normal but it's still out of the way.
I'd use somthing like this behind the OK button on the popup

me.visible = false
DoCmd.OpenQuery "QueryName",, acReadOnly
DoCmd.OpenReport "ReportName", acPreview

If you need, the popup form can be closed along with the report from it's OnClose event, the user none the wiser
 
Sounds like you have the basic set up so far. Form gets the info, calls query that runs using that info, which opens a report to display the gathered info. What it sounds like is your form is unloading before the query actually runs, which is why the query starts with =[Forms]![SubFrmSearchContractDetails]!
[Contract Name] (I assume ContractName is the textbox on the popup form)
a good trick is to make the popup invisible instead of closing it. the textbox can then be referenced like normal but it's still out of the way.
I'd use somthing like this behind the OK button on the popup

me.visible = false
DoCmd.OpenQuery "QueryName",, acReadOnly
DoCmd.OpenReport "ReportName", acPreview

If you need, the popup form can be closed along with the report from it's OnClose event, the user none the wiser
 
Sounds like you have the basic set up so far. Form gets the info, calls query that runs using that info, which opens a report to display the gathered info. What it sounds like is your form is unloading before the query actually runs, which is why the query starts with =[Forms]![SubFrmSearchContractDetails]!
[Contract Name] (I assume ContractName is the textbox on the popup form)
a good trick is to make the popup invisible instead of closing it. the textbox can then be referenced like normal but it's still out of the way.
I'd use somthing like this behind the OK button on the popup

me.visible = false
DoCmd.OpenQuery "QueryName",, acReadOnly
DoCmd.OpenReport "ReportName", acPreview

If you need, the popup form can be closed along with the report from it's OnClose event, the user none the wiser
 
Sounds like you have the basic set up so far. Form gets the info, calls query that runs using that info, which opens a report to display the gathered info. What it sounds like is your form is unloading before the query actually runs, which is why the query starts with =[Forms]![SubFrmSearchContractDetails]!
[Contract Name] (I assume ContractName is the textbox on the popup form)
a good trick is to make the popup invisible instead of closing it. the textbox can then be referenced like normal but it's still out of the way.
I'd use somthing like this behind the OK button on the popup

me.visible = false
DoCmd.OpenQuery "QueryName",, acReadOnly
DoCmd.OpenReport "ReportName", acPreview

If you need, the popup form can be closed along with the report from it's OnClose event, the user none the wiser
 
Hi Golgo 1 cheers for your response all running nicely now thank you so much!

Hayley
 
One small problem I notice that although this is all working fine now If I select my cancel button(it cancels the action which is fine)however it then brings up the default access dialoug box with my specified criteria which I don't want. I had it running in this way previously where should I look to to take this out??

Thanks in advance
 

Users who are viewing this thread

Back
Top Bottom