Results 1 to 4 of 4

Thread: form to report in access

  1. #1

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    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!!!

  3. #3

    Thread Starter
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Sorry for being stupid.


    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]

  4. #4
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    It seems ok to me. If you have problems with that, what is the text of the error message?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width