Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MultiUse DoCmd.Report (A2K)

    OK, I'm out of practice with respect to finding exactly what I want in the Forum. I even found some of my old stuff that didn't quite answer my current question. And before I bury myself in multiple queries and multiple reports and multiple labels, I thought I'd come back to the Access well to see if someone could be kind enough to point my in the right direction.

    I've already created 14 almost identical queries. Didn't really want to.

    Sorry, but I forgot how to tab.
    This first line is: qry_GCO 04 with Status01 = 1 and GCO - Student = Null
    Query GCO - Status GCO - Student
    qry_GCO 04 – Status01 1
    qry_GCO 04 – Status02 2
    qry_GCO 04 – Status03 3
    qry_GCO 04 – Status04 4
    qry_GCO 04 – Status05 5
    qry_GCO 04 – Status06 6
    qry_GCO 04 – Status07 7
    qry_GCO 04 – Status08 8
    qry_GCO 04 – Status09 9
    qry_GCO 04 – Status10 10
    qry_GCO 04 – Status11 0 11
    qry_GCO 04 – Status12 0 12
    qry_GCO 04 – Status13 1 12
    qry_GCO 04 – Status14 2 11


    Scenario:

    14 Queries using tbl GCO Membership as source
    Two Fields being analyzed: GCO - Status & GCO – Student

    One Label Design: rpt_GCO - MailingLabels
    Uncertain as to what to use as DataSource based on what I want to do.
    I sure don't want 14 queries and 14 label designs

    There has got to be a way where I can:

    DoCmd.OpenReport "rpt GCO - MailingLabels", acViewPreview, , strWhere

    Thanks in advance for any help on this
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MultiUse DoCmd.Report (A2K)

    So what exactly do you want to accomplish? <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MultiUse DoCmd.Report (A2K)

    Hi Hans,

    Nice to hear from you again. Notice that I haven't lost the knack of asking an incomplete question?

    If I recall, there was a method whereby within the actual OnClick event of producing the label, I could:

    a) Refer to one specific query
    Identify search specs to be applied to that query, like, Status = 1 and Student = Null or Status = 2 and Student = 11
    c) And having identified those specs, could do the DoCmd.OpenReport referring back to those specs.
    d) That way I only have one query, one label design and 14 different Buttons/OnClick Events.
    Cheers,
    Andy

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: MultiUse DoCmd.Report (A2K)

    I'd specify the values for Status and Student on a form, for example using combo boxes.
    Let's say that you have a form frmParameters with combo boxes cboStatus and cboStudent.
    Open the query in design view and add the following in the Criteria line for the Status column:

    [Forms]![frmParameters]![cboStatus]

    and in the Criteria line for Student:

    [Forms]![frmParameters]![cboStudent]

    Use this query as record source for the report. You need only a single button on the form that opens the report.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MultiUse DoCmd.Report (A2K)

    This unfortunately is a probono-type task that I inherited and the tables and queries with the previously mentioned data fields and all of the data are already in place.
    That was the reason I was trying to come up with the scenario I ws describing.
    I guess what I was looking for was a way that I could in:

    Private Sub butMailingLabels_Click()
    DoCmd.OpenReport "rpt_GCO - MailingLabels", acPreview
    DoCmd.RunCommand acCmdZoom100
    End Sub

    a) refer to qry_GCO 01 - Membership - 01 - Master, and the two fields, GCO - Status & GCO - Student with specific numeric criteria
    and then do the DoCmd.OpenReport thing.

    I can't go back and redesign their forms, so I guess I'll just do the 14 query/ 14 labels scenario. It's simple, just not neat
    Cheers,
    Andy

  6. #6
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MultiUse DoCmd.Report (A2K)

    Hans,

    I find that if I talk to myself long enough as well as dredging through old client code you can sometimes come up with something that works like this:

    DoCmd.OpenReport ReportName:="rpt_GCO - MailingLabels", WhereCondition:="[GCO - Status]=1", View:=acPreview
    DoCmd.RunCommand acCmdZoom100

    I'll deal with the multiples later. Thanks again for your suggestions,
    Cheers,
    Andy

Posting Permissions

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