Showing the results of a parameter form in a form!

L

Lozzaw

Hi

I have used Microsoft's help to create a form which runs a parameter query.
After setting the parameter values in the form I click OK and the results are
displayed in a list. How would I get the results to be shown in a
pre-designed form?

N.b. Using Microsoft help, I coded the On Click Event on the parameter form
thus:

Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenQuery "Company Details by Postcode or Position QRY",
acViewNormal, acEdit
DoCmd.Close acForm, "Company Details by Postcode or Position FRM"
End Sub

Thanks
 
F

fredg

Hi

I have used Microsoft's help to create a form which runs a parameter query.
After setting the parameter values in the form I click OK and the results are
displayed in a list. How would I get the results to be shown in a
pre-designed form?

N.b. Using Microsoft help, I coded the On Click Event on the parameter form
thus:

Private Sub OK_Click()
Me.Visible = False
DoCmd.OpenQuery "Company Details by Postcode or Position QRY",
acViewNormal, acEdit
DoCmd.Close acForm, "Company Details by Postcode or Position FRM"
End Sub

Thanks

First.... Create a form which uses the query as it's recordsource.

Then code the Click event on the form you use to enter the parameters:

Private Sub OK_Click()
DoCmd.OpenForm "FormName"
DoCmd.Close acForm, Me.Name
End Sub

What will happen is that after you enter the parameters in the form
and click the command button, the other form will open with the
filtered data, and the parameter form will close. You do not see the
query at all (except in the form).
 
L

Lozzaw

Fred

Thanks v much for your help, that's brilliant and almost works perfectly!

The only strange thing is that the form which shows the results (Company
Details) has got a sub-form (Company Contacts) and although the sub-form
displays as normal, none of the data in the sub-form does.

Any ideas?

Thanks, Lozza
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

searching from a form 3
Help With The Code 25
message if parameter not found 2
Custom parameter dialog boxes 2
debug error 1
Refreshing a Form 7
Lost Focus of Form 1
Form to run query Error 2001 1

Top