What is the page number variable?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OSHall407
    New Member
    • May 2010
    • 1

    What is the page number variable?

    I am using MS Access 2003 with VB 6.5. I am trying to reference the page number variable with my cmdPrint so that whatever page is currently on my form will print and no others. I have it working for everything except when I use the find/search function as my counter (labels X at the moment) doesnt function correctly when I jump to a record out of sequence. my code looks like this so far:

    Private Sub cmdPrint_Click( )

    On Error GoTo Err_cmdPrint_Cl ick

    DoCmd.PrintOut acPages, X, X ' Print current page based on counter variable "X"



    Exit_cmdPrint_C lick:
    Exit Sub

    Err_cmdPrint_Cl ick:
    MsgBox Err.Description
    Resume Exit_cmdPrint_C lick


    End Sub


    X adds one when the user clicks next and subtracts one when the user goes previous and the mouse wheel is deactivated. So if the user only uses the next and previous keys everything works splendid.

    VB and Access help tell me that the variable [Page] is my page variable but everytime I attempt to make reference to it I get the error:
    Page =< You entered an expressions that has an invalid reference to the pro...

    How to I get around this so that I can make reference to this variable?
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. I suspect that the problem you face is not actually related to what you have shown us, but to what you are doing re your search and what you expect a 'page' to be referring to.

    For your form, you can refer to the current page using the Page property just as the help has told you - and as it is on your current form you should only need to use

    Code:
    DoCmd.PrintOut acPages, Me.page, 1
    to print the currrent page.

    I am not sure what you mean by 'jumping to a record out of sequence', and am unclear as to what you are trying to do. Could you perhaps expand on this for us?

    To be clear, pages on forms are NOT record numbers - if you want to print out a record out-of-sequence the page property is not your answer at all.

    -Stewart

    Comment

    Working...