Click to See Complete Forum and Search --> : form to report in access
Ianpbaker
Apr 4th, 2000, 06:52 PM
On the current project I am working on I have a report that runs off a query that takes two paramaters It works fine but the user has to enter the paramaters with the usual
un-helpfull input boxes that access suplies. Is there any way I can use a small form created by myself that passes the query to the report with the paramaters
Forest Dragon
Apr 6th, 2000, 07:56 PM
Follow these steps:
1. Create the form.
2. Change the report's source query to use the values of the form's controls as parameters.
That needs to look similar to this sample:
SELECT * FROM Table1 WHERE Field1=Forms!Form1!TextBox1 And Field2=Forms!Form1!TextBox2
3. Write code in the form's class module to open the report.
You should put a CommandButton control on the form and use its Click event.
Private Sub Command1_Click()
DoCmd.OpenReport "Report1"
End Sub
Good Luck!!!
Ianpbaker
Apr 6th, 2000, 10:08 PM
Sorry for being stupid.
:confused:
I've tried putting what you wrote into the record source
Using the following query (It is long but I know it works and I have only just found out about aliases)
SELECT tblhotels.Hotelkey, tblhotels.hotelname, tblcorrespondance.appointment_date, tblcorrespondance.appointmenttime, tblcontacts.address, tblcontacts.tubestation, tblcontacts.phoneno, tblcontacts.title, tblcontacts.[1stName] AS Expr1, tblcontacts.surname FROM (tblhotels INNER JOIN tblcontacts ON tblhotels.Hotelkey = tblcontacts.hotelkey) INNER JOIN tblcorrespondance ON tblhotels.Hotelkey = tblcorrespondance.hotelkey WHERE tblcorrespondance.appointment_date = Forms!getapointments!txtdate AND tblhotels.location= Forms!getapointments!cboloc
Am I putting it into the right property (I putting it in at design time) Or am I doing something else completly stupid.
Thank you very much for your help becuase I am starting to go bald and grey because of this thing.
:d
[Edited by Ianpbaker on 04-07-2000 at 04:10 PM]
Forest Dragon
Apr 8th, 2000, 02:08 AM
It seems ok to me. If you have problems with that, what is the text of the error message?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.