Windows MS Access form -> query -> report

Discussion in 'Software' started by TheStockBroker, 21 Oct 2013.

  1. TheStockBroker

    TheStockBroker Modder

    Joined:
    19 Nov 2009
    Posts:
    1,533
    Likes Received:
    110
    Hi Chaps,

    I could use a hand if someone is versed in these matters!

    Essentially, I'm trying to use an MS Access form to provide the parameters of a query that builds a report based on these results. For the large part, it works well, but I have a problem that I can't seem to find a solution for - I'm sure it must be possible, but I'm probably just searching for the wrong words/terms!

    My problem is that I only want the form to pass the contents/parameters of a combo box/text box to the query if that control is enabled.

    Any ideas?

    Cheers,

    TSB
     
  2. Kernel

    Kernel Likes cheese

    Joined:
    29 Sep 2003
    Posts:
    1,195
    Likes Received:
    47
    I think I get what you mean, for your query to use data you have pre-defined in a form, you need to break out of the SQL query to point to the desired form.
    It should look something like this. (Random example.)

    Code:
    strSQL = "SELECT * FROM tblJobs WHERE DateRaised BETWEEN #" & ConvertToAmericanFormat(Left(Forms!frmReports!axcFromDTpicker, 10)) & "# AND #" & ConvertToAmericanFormat(Left(Forms!frmReports!axcToDTPicker, 10)) & "# AND DateComp IS NULL AND AllocatedTo='" & Forms!frmReports!cboAllocatedTo & "' AND UserRaised='" & Forms!frmReports!cboIssuer & "'"
    The break is at the end when I have Combo box's defining criteria.

    '" & Form.formname.criteria &"'

    At work so only brief description, if you need more info post back and I'll get to when at home :)
     
  3. Kernel

    Kernel Likes cheese

    Joined:
    29 Sep 2003
    Posts:
    1,195
    Likes Received:
    47
    Did you ever get sorted with this TSB?
     

Share This Page