Results 1 to 3 of 3
  1. #1
    iProRyan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Dec 2011
    England, United Kingdom

    Macro to open report based on value in a form

    Hi Guys,

    Having an issue with one of my macros and can't seem to find a solution, wonder if anyone can help.

    Basically I have a report called rptCustomerInvoice which is based on a query (qryCustomerInvoice) and to generate an invoice you enter the JobID using a parameter value in the query. (In the query for the criteria for JobID it's [Enter Job ID:]

    But what I am also trying to achieve is to have a button on the Jobs form, which shows details of the jobs, that was also open this invoice based on the value of the JobID field on this form, the macro so far looks like this:

    ReportName: rptCustomerInvoice
    Where Condition: ???

    This where condition is where I am trouble I have tried qryCustomerInvoice.JobID = frmJobs.JobID and the table, so basically my question is, what do I need the where condition to be to achieve what I want?

    Any help is appreciated,

    Last edited by June7; 02-23-2014 at 12:27 PM.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    The dynamic parameter and the WHERE condition are mutually exclusive. Use one or the other.

    In either case, refer to form control, something like:

    Instead of [Enter Job ID:] use

    or in the WHERE condition

    [Job ID]=Forms!formname!controlname
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    iProRyan is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Dec 2011
    England, United Kingdom
    So I'd have to create a copy of my existing query, name it something similar and then use the forms value in the criteria for JobID and use a Macro to OpenReport where condition = qry?

    Edit: Well I did the above and that works like a charm so I'll stick to it! Thank you!
    Last edited by iProRyan; 02-24-2014 at 03:47 AM. Reason: See Edit

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2013, 02:24 AM
  2. Macro - Open Report, SetValue
    By NLA in forum Programming
    Replies: 1
    Last Post: 11-17-2012, 09:53 PM
  3. Open report based on a value
    By boxsta in forum Reports
    Replies: 12
    Last Post: 06-11-2012, 09:26 AM
  4. Macro to open a report that includes certain dates?
    By hartandsoul85 in forum Access
    Replies: 2
    Last Post: 05-11-2012, 11:47 AM
  5. Replies: 1
    Last Post: 12-21-2010, 09:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums