Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    Unanswered: Embarassing Page Problem

    Maybe I just haven't had enough coffee, but I can't figure this problem out for the life of me.

    Anyone know how to open a report to a particular page? I've tried using the Report.page property in code, but it doesn't seem to do anything. DoCmd.GoToRecord is a no-go, and I can't use the report's Recordset.MoveNext or Find methods either.

    Thanks in advance!!

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Lint Diggy
    Maybe I just haven't had enough coffee, but I can't figure this problem out for the life of me.

    Anyone know how to open a report to a particular page? I've tried using the Report.page property in code, but it doesn't seem to do anything. DoCmd.GoToRecord is a no-go, and I can't use the report's Recordset.MoveNext or Find methods either.

    Thanks in advance!!
    Ah - how frustrating! I have posted on this - I know because two separate guys on two different forums asked about the same question and I linked between the posts. But this forum's search facility is as much use as a chocolate fire guard, can't google it and can't find on the other site (experts-exchange if interested). Will keep looking. The long and the short of it was that it wasn't easy and wasn't elegant.
    Last edited by pootle flump; 01-19-06 at 19:43.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Aha - that's right - I think we ended up here
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Stephen Lebans
    Even I have to admit these functions are not very useful.
    I do seem to recall a degree of ineffectiveness with these functions now I come to think of it....
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    I guess it's not so embarassing now

    Goodness man! That's one serious hack! For all those interested, the only solution presented for this seemingly simple problem so far is to use Windows Handles and API calls to actually simulate the user clicking the record navigator at the bottom of a report.

    I'll see if I can get it to work, and I thank you Stephen for the help.

    In the meantime, if anybody is aware of a slightly less intricate way of solving this, I'm a captive audience!

    Thanks all!

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Lint Diggy
    In the meantime, if anybody is aware of a slightly less intricate way of solving this, I'm a captive audience!
    I know this is the second time I've done a search on this and both times I ended up in the same place. I very much doubt that someone of Leban's quality would spend so long putting together such a complicated routine if there was a significantly easier method - but I too would be interested to hear if there is one.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what is generating the requirement to go to a specific page - is it a page number, a particular customer. Could you provide some detail on what the report is and why you need to jump to a particular page.
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    Thumbs up

    Well Stephen, the posts in your code samples state that the only thing missing is a meaningful purpose for your functions and some error checking. I can provide both now.

    Thank you so much for the help. It works very well.

    It'll take a while to comb through and see exactly what's going on under the hood, but I think I grasp what it is you've come up with. Hat's off, that's beyond creative.

  9. #9
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    Here's Why

    Mark and Stephen, since you've expressed interest as to 'why' I need to do this, here's the long and ... well, there's no short, so the long and long of it:

    My company has a Wafer Fab wherein we make some super high-technology, way over my head, tiny little parts. A Wafer is a just a 4" or 6" silicon (usually) disc. Our people do some fancy chemical things to it and make a certain number of identical grids on the wafer. Inside each grid is a number of parts. Right now, we're doing 12 parts per grid, so we have Part A1....A4 to C1....C4.

    I've set up a database to keep track of the results of each assembly process for these parts. For one of the steps (the most important one), we run a variable current through the part and a machine records the output in a data file.

    My database can import these data files and shows a little graph of the ouput. I wanted to set up a report so that when the user clicks on the graph, it'll show a big graph so we can see all the details of the test we've run.

    So say a user is currently looking at Grid 20. They can cycle up and down through each of the 12 parts and the little graph changes. Now the user is looking at Part A2, and clicks the graph. I want the report to open up and go directly to page 2 (A2 is the second part). I know I could just limit the report to only show part A2, but then the user would have to close the report, move over to part A1, and then click the graph again. With 12 parts, that's agonizing.

    'Treat mouse clicks like gold'.

    Sound reasonable?

  10. #10
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    Not as good as I thought

    First off, in glancing at the replies to my question, I somehow convinced myself that Pootle's name was Stephen. So lets replace all of my 'thank you Stephen's with 'thank you Pootle'

    That aside, there's still a problem.

    The code Pootle pointed me to works great, but only once. Anytime after that, trying to navigate to a specific report page does nothing at all.

    I know that this is a trivial matter, but good UI design is mostly implementing what programmers find to be trivial matters.

  11. #11
    Join Date
    Feb 2005
    Location
    Blacksburg, Virginia
    Posts
    43

    Talking Got It!

    Problem solved everyone.

    If anyone stumbles across this forum, here's how to make it work.

    Get the code that Pootle pointed to (created by Stephen Lebans). The fturnpage function does all the dirty work. It will find the record selector controls at the bottom of the report screen and programatically click the left or right buttons until the report shows the requested page.

    However, this function only works as is the first time through. From then on, it does nothing.

    Here's where the problem is:
    Code:
    If hWndChild = 0 Then
        Do While intposx < rc.Right
    
            lngTemp1 = MakeDWord(intposx, (rc.Bottom - rc.Top) / 2)
            lngRet = apiPostMessage(hWndOSUI, WM_LBUTTONDOWN, 1&, lngTemp1)
            lngRet = apiPostMessage(hWndOSUI, WM_LBUTTONUP, 1&, lngTemp1)
            lngRet = apiPostMessage(hWndOSUI, WM_LBUTTONDOWN, 1&, lngTemp1)
            lngRet = apiPostMessage(hWndOSUI, WM_LBUTTONUP, 1&, lngTemp1)
            DoEvents
            'Debug.Print "Posx:" & intposx & "  lbgTemp1:" & lngTemp1
            hWndChild = apiGetWindow(hWndOSUI, GW_CHILD)
            If hWndChild <> 0 Then
            lngWindowLocation = lngTemp1
               Exit Do
            End If
            ' Let's keep moving 4 more pixels to the right
            intposx = intposx + 4
            DoEvents
        Loop
    End If
    The variable hWndChild is a global, and is 0 the first time through, but never again. Remove the surrounding If/End If statement from the code and it works every time.

    I hope this helps someone else out someday!

    Thanks again.

  12. #12
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Question

    Quote Originally Posted by pootle flump
    I know this is the second time I've done a search on this and both times I ended up in the same place. I very much doubt that someone of Leban's quality would spend so long putting together such a complicated routine if there was a significantly easier method - but I too would be interested to hear if there is one.
    Hey Pootle,

    I just fishing here, but can't that be done somehow with the Bookmark property?
    Curious

    BUD

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Lint Diggy
    Get the code that Pootle pointed to (created by Stephen Lebans).
    Lol - glad we got that sorted out - I don't want to start taking credit for Leban's work... though I'll take it if it is offered

    My only other thought, given your requirments, was a sub report to the (presumed) form that the users see the little graph on - this may, of course, mkae the "big" graph too small for practical use....

    Quote Originally Posted by bud
    Hey Pootle,

    I just fishing here, but can't that be done somehow with the Bookmark property?
    Curious

    BUD
    Afraid not- not until MS decide to "enable" the report recordset property.

    You did, however, drop an idea into me lil' noggin' - what about creating a pop up form - stick some bespoke navigation buttons in the header, set the recordsource to some sort of subset (perhaps a list of the distinct groups) of the record source for the report and put the report in as a sub report of the form. You can navigate using the navigation buttons but, crucially, indirectly control the visible page of the sub report by controlling the recordset property of the form (something MS does allow). Not tested of course
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I thnk a probllem here could be response times, depending in the volume of data and complexity of the graph it could be very slooooooow. For these sort of apps I tend to dump the report into Acrobat and let the users do what the heck they like. It owul have the added benefit that your users have a timestamped separate report which could stay around for a while for audit or customer necklace parties.

    That maybe becasue i'm too much of a scardey cat compard to pootle izyrider and try to avoid complex win API calls - some them seem to change to frequently for my liking.
    I'd rather be riding on the Tiger 800 or the Norton

  15. #15
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by healdem
    For these sort of apps I tend to dump the report into Acrobat and let the users do what the heck they like.
    As it happens I do similar (for similar reasons) but using Excel (as a side issue I find the graphs in Excel more intuitive and more powerful than in Access - anyone else?).

    The reason I didn't suggest this is because of the "I need the report to contain all the graphs but to automate going to page n" criterion although I guess it wouldn't be unsurmountable now you mention it.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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