Results 1 to 8 of 8
  1. #1
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    page total attempt fails with "enter parameter value"

    Trying to get counts in the bottom of each page of a report; cut and pasted from MS and lots of sites, but get requests for a parameter when the report opens.

    I have of course a text box in the footer with " = txtpageSum ", and I get a request for this as the parameter value.

    Some test code:

    Option Compare Database
    Dim txtpageSum As Integer

    Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
    If PrintCount = 1 Then
    ' txtpageSum = txtpageSum + ExtendedPrice
    ' txtPageQuantity = txtPageQuantity + Quantity
    txtpageSum = 22 'test; keeping it simple
    End If
    End Sub

    Private Sub PageHeaderSection_Print(Cancel As Integer, _
    PrintCount As Integer)


    txtpageSum = 0
    ' txtPageQuantity = 0
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You can't refer to a variable from outside VBA. You could create a public function that returned the value of the variable:

    =FunctionName()
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    Is it not being done here ?

    Many thanks for the reply !

    What about this :


    http://office.microsoft.com/en-us/ac...001122444.aspx

    All I'm trying to do is run the MS code in the "Placing sums in the page header or footer" section of this page.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    In that code, txtPageSum is the name of a textbox, not a variable:

    You create a text box in the Page Footer section to hold the page total for the dollar sum of sales, and another text box in the Page Footer section to hold the page total for the quantity of products sold. Let's call these values txtPageSum and txtPageQuantity.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32
    Paul:

    As a fan of John Galt you'll enjoy this I hope: http://miltonfriedman.blogspot.com/
    Friedman (nobel prize) is one of the best men we had.

    As to this Access issue, many thanks; changed the text box name to txtpageSum and have lost that error; still nothing printing on the page, but it's midnight and I'll look again in the morning.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Cool, I'll check it out.

    Have you gotten rid of the variable? Access will set it first, if unspecified. I like to use Me so there's no confusion:

    Me.txtpageSum = 22
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    thanks

    That did it ! thanks !

    Friedman wrote a series of non academic books; "Capitalism and Freedom" and "Free to Choose" the most popular.

    I cant recommend them enough.

    Rand is a brilliant joy , but it’s hard to site her in debate; however Friedman, as a Nobel winner in economics, always carries a lot of weight.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Ah good, glad it worked. And thanks for the link; I'll be watching them soon!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Behavior of the "Enter" key on textbox
    By Grooz13 in forum Forms
    Replies: 1
    Last Post: 01-13-2011, 03:00 PM
  2. Replies: 4
    Last Post: 01-06-2011, 10:52 AM
  3. location of "enter parameter value" box
    By dcjohnso11 in forum Programming
    Replies: 1
    Last Post: 06-25-2010, 11:36 AM
  4. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  5. Replies: 0
    Last Post: 03-25-2009, 05:26 AM

Tags for this Thread

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