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..
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..
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?
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
'-----------------------
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.
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
'-----------------------
The issue is that only acViewPreview is what allows me to iterate through the .pages
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
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.
..yes.. I always for get... im kinda'of an ol' schooler' ..Will do next time.. thanks Alex.