Results 1 to 6 of 6

Thread: Printing selection criteria header status

  1. #1
    Join Date
    Dec 2009
    Posts
    192

    Printing selection criteria header status

    Hello,
    Here is my problem, I created a form multiple research from a table created by a query. I have six search criteria via six combox. I get the results in a window lstresults. From a button Btimprimer I print a report with the same fields as lstresults. These steps work perfectly. However I would edit in the header of the state the value of the six search criteria (cmbRechCateg et seq) and statistics.
    Here is the code for it
    Code:
    Option Compare Database
    
    Private Sub chct_Click()
    If Me.chct Then
        Me.cbrcct.Visible = False
    Else
        Me.cbrcct.Visible = True
    End If
    RefreshQuery
    End Sub
     
    
    End Sub
    Last edited by Vodka; 17-02-2010 at 01:00 AM.

  2. #2
    Join Date
    Dec 2009
    Posts
    292

    Re: Printing selection criteria header status

    Hello,
    To change the settings I use the argument OpenArgs (the latter to open report) by forming a string.
    ex imitation of code to the calling form
    Code:
    Sun mesParam as string
     
    if mncrt then
       if mnpar <>"" then
         mnpar = mnpar & vbNewLine:'Move to the line with each criterion
       end if
       mnpar = & mnpar "My test text"
    end if
    Code:
    DoCmd.OpenReport MyReport ,,,,, mnpar:'mnpar must be the last parameter

  3. #3
    Join Date
    Nov 2009
    Posts
    333

    Re: Printing selection criteria header status

    Hello,
    In the report you can include the following part of code.
    Code:
    Sun m_str as string
     
    private sub OnOpen()
       if not isnull(I.OpenArgs) then
         m_str =I.OpenArgs
       end if
    end sub
     
    Public function LireSousTitre() as string
       LireSousTitre = m_str
    end function
    In the report, preferably in a header section which may have variable height (can grow = true, can shrink = true) define a text field 'Soustitre' with a source: LireSousTitre = ()

  4. #4
    Join Date
    Nov 2009
    Posts
    583

    Re: Printing selection criteria header status

    Hello,
    The function OpenArgs statement is not valid in Access 2000. Only from the 2003 version. For my part in calling the state I put a text field that contains the title and then in my statement I referred to. It is also possible to use a global variable (according to experts is not advisable but I do not know why) and then referring to it. Only the code must be placed in the event to print if it does not work

  5. #5
    Join Date
    Nov 2009
    Posts
    518

    Re: Printing selection criteria header status

    Hello,
    Code:
    function OpenArgs statement is not valid in Access 2000. Only from the 2003 version.
    Good point but from Access 2002 (XP).
    For my part in calling the state I put a text field that contains the title and then in my statement I referred to.
    This solution works since version 2.0 which is very convenient. It has the disadvantage of binding the state to form, changes the form and your report can be broken without you knowing. The OpenArgs allows the report to remain independent and self sufficient.

  6. #6
    Join Date
    Nov 2009
    Posts
    356

    Re: Printing selection criteria header status

    Hello,
    It is also possible to use a global variable (according to experts is not advisable but I do not know why)
    The pb of global variables is that they are visible and modifiable throughout the code. It is very easy in a module and change the value to plant and another module, again without knowing which one. So when you have a variable Global and they are touched, it must traverse the entire application to find out where and how it is used. A recommended practice is to hide (make 'private') information which has not be known outside the current module and use parameters to pass information between modules. You can also use a class module in Access or property on a form that presents the variable read-only for everyone to use information and the owner of the change. These concepts are grouped in the literature under the term 'data encapsulation'.

Similar Threads

  1. Connect USB 3.0 front case panel header to motherboard w/o a header?
    By Dogs-Day-Out in forum Motherboard Processor & RAM
    Replies: 4
    Last Post: 14-04-2012, 07:02 PM
  2. Replies: 1
    Last Post: 15-01-2012, 05:48 PM
  3. IIS replaces redirect status header from PHP
    By Tam^bura in forum Networking & Security
    Replies: 7
    Last Post: 20-06-2011, 10:54 PM
  4. Exim, Spamassassin and X-Spam-Status Header
    By Bower in forum Windows Software
    Replies: 4
    Last Post: 18-06-2010, 04:17 AM
  5. IIS7: Add expires header or cache-control header
    By quota in forum Software Development
    Replies: 3
    Last Post: 06-06-2009, 07:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,241,946.55598 seconds with 17 queries