Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2005
    Posts
    79

    Unanswered: OpenArgs Multiple Information

    I am having the worse time with this. I have openargs working with one parameter, but can't with more than one. This is the code for the On-Click. strReportName is passing a string for the type of report. strReportVisible is passing a string to make a text box in the next form NOT visible (visible=true). Any help with this will be greatly appreciated.

    Private Sub cmdPC_Click()
    Dim strOpenArg As String
    Dim strReportName As String
    Dim strReportVisible As String
    strReportName = "PC Compilation Report"
    strReportVisible = "invisible = true"
    strOpenArg = strReportName & "_" & strReportVisible

    DoCmd.OpenReport "Compilation Report ", acViewPreview, , "type = 'PC'", , strOpenArg

    End Sub



    then on the report open:

    Private Sub Report_Open(Cancel As Integer)
    Dim strReportName As String

    strReportName = Mid(OpenArg, InStr(OpenArg, "_") + 1)
    TxtTotalNotebooks = Mid(OpenArg, 1, InStr(OpenArg, "_") - 1)

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Is this something that you're going to reuse in a lot of a different places? You don't have anything dynamic in there...

    If this IS something that's being used dynamically and fed by a form, why not refer to the original source instead of trying to pass stuff through openargs?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    agree with Teddy

    BTW the code to access information inanother form is:
    <myparameter> = forms!<myformname>!<mycontrolname>

    <mycontrolname> can also be a variable

    eg:- strEquipType=forms!frmSelectEquipType!cmbEquipType

  4. #4
    Join Date
    Nov 2005
    Posts
    79

    OpenArgs

    This information is based on command buttons that are clicked. For each type(PC, notebook, software, copier, printer, hub, routers), the heading will change on the report based on what is selected. And certain controls on the report will need to be invisible based on the type.
    Last edited by miracleblake; 11-17-05 at 14:47.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    That's the "TYPE = " part right? What can't you accomplish knowing "TYPE = 'PC'" ? Controls on the report will need to have visibility toggled during a different event entirely...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Nov 2005
    Posts
    79

    OpenArgs

    So, is there no way to extract the information that is needed by the current coding that I have?

  7. #7
    Join Date
    Nov 2005
    Posts
    79

    OpenArgs

    The reason I am trying to use the OpenArgs is to change information in the header of the report. Maybe there is a simpler way of counting the types without using OpenArgs. Here is what I am trying to do. The code currently filters for Type when opening. On the PC report, I need to count the number of PCs in the table and display the total on the report. On the Printer report, I need to count the number of printers in the table and display total on the report (etc. for each type.) However on the ALL command button, I need the report to display the total number of computers, the total number of laptops, (etc). of all items in the table Thank you.

  8. #8
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You're already there if this is the method you're dead set on using. We can help more if you explain your intentions with these lines:

    strReportName = Mid(OpenArg, InStr(OpenArg, "_") + 1)
    TxtTotalNotebooks = Mid(OpenArg, 1, InStr(OpenArg, "_") - 1)

    I can't help but notice strReportName is not declared. Open arguments are called through OpenArgs, not OpenArg, and it appears you are trying to set the value of a textbox in the onopen event, which isn't going to work.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  9. #9
    Join Date
    Nov 2005
    Posts
    79

    Passing Information

    The reason I am trying to use the OpenArgs is to change information in the header of the report. Maybe there is a simpler way of counting the types without using OpenArgs. Here is what I am trying to do. The code currently filters for Type when opening. On the PC report, I need to count the number of PCs in the table and display the total on the report. On the Printer report, I need to count the number of printers in the table and display total on the report (etc. for each type.) However on the ALL command button, I need the report to display the total number of computers, the total number of laptops, (etc). of all items in the table Thank you.

  10. #10
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You could evaluate for null when compiling your totals. If you've limited criteria to just laptops, every other category is going to be null. On the other hand, I'm lazy, so I would probably declare a global variable and be done with it.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  11. #11
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Obviously we're working with Access 2002 and up ... Why don't you use the Split function on your parameter string? Example:

    Dim ParmListString() As String
    ' Format:
    '
    ' Parent ID, New Work Order [, Work Order #
    ' [, Work Order Tbl (, Record #)
    '
    ParmListString = Split(Me.OpenArgs, ",", -1, vbTextCompare)
    WhosMyParent = CInt(ParmListString(0))
    IsNewWO = CBool(ParmListString(1))
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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