Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Ok. just verified (as it has already been) .page/.pages will NOT work in REPORTVIEW. REPORTVIEW is just a screenshot of the report and does not have datafield tied to it.



    ..Back to square one..

  2. #17
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180

    How to change report to page 2 programmatically?

    Let's go at it a different way then.

    What is it you are trying to achieve?
    Do you want a specific value from the Report?

  3. #18
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    Well.. I am attempting to programmatically change report pages. Still thinking of a stable way to achieve this..

    If I make this work somehow without a SENDKEYS.. it can work for me..

    '-----------------------
    Dim lngPage As Long

    DoCmd.OpenReport "rptMAINT_LOG", acViewPreview 'NA 12_3_13 - open report in print preview

    With Reports!rptMAINT_LOG


    Do Until .Page = .Pages


    On Error GoTo ExitSub 'the next row fails if no report is in focus
    If Screen.ActiveReport.Name = "rptMAINT_LOG" Then
    lngPage = .Pages
    SendKeys "{PGDN}", False <------------ NOT AVAIL W acViewPreview ------< Need an alternate method
    If .Page = lngPage Then GoTo MsgBx

    End If

    Loop

    End With

    '-----------------------

  4. #19
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180

    How to change report to page 2 programmatically?

    May I ask why.
    Is there something on that page you wish to show?
    Is it always on a certain page?
    Does it have to be on that page?

    Can you not use acPreview like in my example as that works fine with SendKeys.

  5. #20
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    If I make this work somehow without a SENDKEYS.. it can work for me..

    '-----------------------
    Dim lngPage As Long

    DoCmd.OpenReport "rptMAINT_LOG", acViewPreview 'NA 12_3_13 - open report in print preview

    With Reports!rptMAINT_LOG


    Do Until .Page = .Pages


    On Error GoTo ExitSub 'the next row fails if no report is in focus
    If Screen.ActiveReport.Name = "rptMAINT_LOG" Then
    lngPage = .Pages
    SendKeys "{PGDN}", False <------------ NOT AVAIL W acViewPreview ------< Need an alternate method
    If .Page = lngPage Then GoTo MsgBx

    End If

    Loop

    End With

    '-----------------------

  6. #21
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    The issue is that only acViewPreview is what allows me to iterate through the .pages

  7. #22
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    SOLVED: Ok .. so this is how I approached the issue.

    '---------------------------------------------
    Private Sub Command17_Click()
    Dim MyFilter As String
    Dim MyPath As String
    Dim MyFilename As String
    Dim CUser As String
    Dim LNumofRecs As Long 'FOR THE NUMBER OF RECS IN THE QRY 12_3_13NA HOME
    Dim IDNum As String
    CUser = Me.Text12
    Udate = Me.Combo2
    '---------------------SETS UP PATHS FOR PDF OUTPUT -------------------------
    MyFilter = ""
    MyPath = "C:\Users\Ahmad\Desktop\signal_db_rs\PDF\" <-------------- test path
    '--------------OPEN REPORT - ------------------------------------
    DoCmd.OpenReport "rptMAINT_LOG", acViewPreview
    '------------------------------- SETUPS UP RECORDSET ---------------
    Dim rs As DAO.Recordset
    Dim qd As DAO.QueryDef
    Set qd = CurrentDb.QueryDefs("081 qryMAIN_LOG_RPT")
    qd.Parameters("[Forms]![frmTIMESHEET_REPORTS]![Combo2]") = #12/3/2013#
    qd.Parameters("[Forms]![frmTIMESHEET_REPORTS]![Text12]") = "nahmad"
    Set rs = qd.OpenRecordset
    If rs.RecordCount = 0 Then MsgBox ("No Recs")
    'COUNT NUMBER OF REC (PAGES) IN QUERY
    LNumofRecs = DCount("LOG_DATE", "081 qryMAIN_LOG_RPT", "USER_DATETIME=#" & Udate & "#")

    While Not rs.EOF
    For i = 1 To LNumofRecs 'iterate through the number of pages in the table - 12_3_13 na

    IDNum = rs(22) <-------- Column 22 is the desired index key I needed to build the relationship to link to the back-end
    MyFilename = IDNum & ".pdf"
    DoCmd.PrintOut acPages, i, i <-------- SUBSTITUTE THIS LINE WITH DESIRED PRINT DRIVER AS NEEDED. (I chose PDF print drivers)
    rs.MoveNext
    Next
    Wend
    Set rs = Nothing
    End Sub
    '-------------------------------------------

    it is now working as intended.. just have to do some minor adjustments and done..

    tricky but works so far...

    Forum Moderators:
    Please clean up this tread with all my useless comments... many thanks to Alex for the suggestions Thanks Alex!

    I will post my final script when done.

    Thank all..

    Regards,
    Naeem~
    App Dev - County of Riverside, CA USA

  8. #23
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180

    How to change report to page 2 programmatically?

    Happy to help
    If you wrap your code in "["CODE"]" "[/"CODE"]" tags it can make it easier to read.
    I forget to do it myself sometimes.

  9. #24
    naeemahmad is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Location
    Riverside, USA
    Posts
    46
    ..yes.. I always for get... im kinda'of an ol' schooler' ..Will do next time.. thanks Alex.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to change query criteria programmatically
    By fekrinejat in forum Programming
    Replies: 2
    Last Post: 02-04-2013, 05:07 PM
  2. Programmatically change default switchboard at startup?
    By romeo_echo in forum Programming
    Replies: 4
    Last Post: 08-05-2011, 11:45 AM
  3. Replies: 2
    Last Post: 08-29-2010, 01:17 AM
  4. how to change report code page
    By broken_ice in forum Reports
    Replies: 1
    Last Post: 06-27-2010, 02:23 AM
  5. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 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