473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Long reports

JustJim
407 Expert 256MB
Against my better judgement, I'm making what is going to be a large report based on the analysis of some survey returns.

I've just re-read Adezii's wonderful article on the specifications in Access and it says that I can have 65,000 odd pages (not going to, but I can) but a section can only be 22 in. (55.87 cm) long, which seem to require a three page breaks per thousandth of an inch or something.

How do I get a listbox, which has no "Can Grow" property to use as many pages as required?

These listboxes are populated by code referenced in their Row Source Type and this type of Sub does have a named argument called acLBGetRowCount. Do I multiply the row count by a size factor for the font to set the height of the listbox control?

Muddled in Melbourne
Jim
Nov 15 '07 #1
12 1675
JustJim
407 Expert 256MB
Against my better judgement, I'm making what is going to be a large report based on the analysis of some survey returns.

I've just re-read Adezii's wonderful article on the specifications in Access and it says that I can have 65,000 odd pages (not going to, but I can) but a section can only be 22 in. (55.87 cm) long, which seem to require a three page breaks per thousandth of an inch or something.

How do I get a listbox, which has no "Can Grow" property to use as many pages as required?

These listboxes are populated by code referenced in their Row Source Type and this type of Sub does have a named argument called acLBGetRowCount. Do I multiply the row count by a size factor for the font to set the height of the listbox control?

Muddled in Melbourne
Jim
Maybe I'll just export the whole darn thing to Excel!
Nov 15 '07 #2
JustJim
407 Expert 256MB
Maybe I'll just export the whole darn thing to Excel!
Bump

Not urgent, not stressing, just wondering if anyone has any thoughts.

Jim
Nov 19 '07 #3
JustJim
407 Expert 256MB
Bump

Not urgent, not stressing, just wondering if anyone has any thoughts.

Jim
Bump again

Not really urgent, not stressing much, the medication seems to be working.

This is a different report, and has to have eight fixed size listboxes but there is only room for one per A4 (letter size) page and I just run out of room. How can I have 65,000 odd pages if I can only have 20" of detail?
Jim
Dec 2 '07 #4
JustJim
407 Expert 256MB
Bump again

Not really urgent, not stressing much, the medication seems to be working.

This is a different report, and has to have eight fixed size listboxes but there is only room for one per A4 (letter size) page and I just run out of room. How can I have 65,000 odd pages if I can only have 20" of detail?
Jim
I seem to have gotten away with adding a couple of group headers using bogus fields. Not very elegant, there's got to be a better way.

Jim
Dec 2 '07 #5
missinglinq
3,532 Expert 2GB
Don't mean to butt into this conversation you're having with yourself, Jim, but here's a few things for you!

The 22" is the working length of of the Detail section or "page" on the screen, and to be honest, probably shouldn't ever be maxed out! Tabbed pages should be used if you need that much real estate for a form. At any rate, this has nothing to do with the printed page. The 65,000 pages is the spec for the actual number of pages that can be printed out. You might have page that only consisted of a customer's name address and phone number, but have have 65,000 customers; the length of the detail section and the number of pages in a report have nothing to do with one another.

The reason that a listbox doesn't have a Can Grow property is that a listbox is a data entry device! Access basically uses the same interface for reports and forms, which is why the listbox (as well as the combobox) is up in the toolbar, but it's not meant to be part of a printed report!

You should , instead, use a subreport. You can use the same SQL/Query as a recordsource, and subreports do have the Can Grow Property!

Linq ;0)>
Dec 3 '07 #6
JustJim
407 Expert 256MB
Don't mean to butt into this conversation you're having with yourself, Jim, but here's a few things for you!

The 22" is the working length of of the Detail section or "page" on the screen, and to be honest, probably shouldn't ever be maxed out! Tabbed pages should be used if you need that much real estate for a form. At any rate, this has nothing to do with the printed page. The 65,000 pages is the spec for the actual number of pages that can be printed out. You might have page that only consisted of a customer's name address and phone number, but have have 65,000 customers; the length of the detail section and the number of pages in a report have nothing to do with one another.

The reason that a listbox doesn't have a Can Grow property is that a listbox is a data entry device! Access basically uses the same interface for reports and forms, which is why the listbox (as well as the combobox) is up in the toolbar, but it's not meant to be part of a printed report!

You should , instead, use a subreport. You can use the same SQL/Query as a recordsource, and subreports do have the Can Grow Property!

Linq ;0)>
Did you hear that voice?
Yes I did.
Spooky wasn't it?
It was, but it made a certain amount of sense.
It did, but sadly, we fill our listboxes by code so that judicious usage of Variable names etc makes them very "swappable". Also once the list box is filled, it is available for writing to Excel since the same Cartesian (x,y) style is used.
Yes we do, but maybe we've shot ourselfs in the footses by trying to be too smart, my precious.
Perhaps, but shhh, here comes the nurse with the medication.

Jim (and special friend)
Dec 3 '07 #7
sierra7
446 Expert 256MB
Jim

I haven't a clue what you are talking about putting a List Box in a report but must try it sometime ! The nearest I've been is when I tried the PrintOut command to print a screen rather than write a proper report.

MissingLinq's idea of putting stuff in sub-reports makes a whole lot more sense. If your data was suitable you could maybe set column widths to put multiple columns on a page if number of sheets of paper is an issue. (Also make the font smaller; whose going to read 65,000 pages anyway?)

However, I do have experience of writing to Excel where there is a 65,000 row limit (65,536 actually and ROWS not PAGES. Customer wanted to de-normalise a perfectly respectable relational database resulting in millions of rows, to export to Excel for sucking in to an Oracle system) You can work out how many Excel files resulted and maybe guess at how easy they were to manage (not).

Stick to Access, don't go to Excel !
Dec 3 '07 #8
JustJim
407 Expert 256MB
Jim

I haven't a clue what you are talking about putting a List Box in a report but must try it sometime ! The nearest I've been is when I tried the PrintOut command to print a screen rather than write a proper report.

MissingLinq's idea of putting stuff in sub-reports makes a whole lot more sense. If your data was suitable you could maybe set column widths to put multiple columns on a page if number of sheets of paper is an issue. (Also make the font smaller; whose going to read 65,000 pages anyway?)

However, I do have experience of writing to Excel where there is a 65,000 row limit (65,536 actually and ROWS not PAGES. Customer wanted to de-normalise a perfectly respectable relational database resulting in millions of rows, to export to Excel for sucking in to an Oracle system) You can work out how many Excel files resulted and maybe guess at how easy they were to manage (not).

Stick to Access, don't go to Excel !
Well, I suppose I should explain, in case anyone else is ever interested.

Well I never wanted 65K pages, I have more respect for trees than that! The way it works now is that when I can control the number of rows in the output (top 25 schools, Languages spoken by year level etc) I format a list box on a report (example code next post if anyone's interested) and display the print preview of the report, letting the operator decide to print or not. When I can't control the output so well (all courses undertaken by all teachers in the state), I make the same sort of list box on a report but open the report hidden, then simply run across the rows and down the columns with two nested for...next loops and send each location to a cell on a spreadsheet. (code for this in next post).

The sub for filling a list box is familiar to me (now, it took a while) and I use it a lot.

Jim
Dec 3 '07 #9
JustJim
407 Expert 256MB
Example code to fill a list box
Expand|Select|Wrap|Line Numbers
  1. Function FillMEA(fld As Control, ID As Variant, row As Variant, col As Variant, code As Variant) As Variant
  2. Static SurvDB As Database
  3. Static rsData As Recordset
  4. Static rsCourses As Recordset
  5. Static strField As String, strStaff As String, Region As String, strSQL As String
  6. Static cntCourse As Long, cntData As Long, Counter As Long
  7. Static Match As Long
  8. Static ColWidth(2) As Long
  9. Static DisplayData() As Variant
  10. Dim ReturnVal As Variant
  11. ColWidth(0) = -1
  12. ColWidth(1) = 400
  13. ColWidth(2) = 400
  14. Match = 0
  15. Select Case code
  16.     Case acLBInitialize
  17.         Region = Reports!rptTotalS.OpenArgs
  18.         Set SurvDB = CurrentDb()
  19.         strSQL = "SELECT ALL_CAMPUSES.CAMPUS_TYPE, tblReturnData.PriSecReturnAs, tblReturnData.MEA_PD_Desc1, tblReturnData.MEA_PD_Staff1, " _
  20.         & "tblReturnData.MEA_PD_Desc2, tblReturnData.MEA_PD_Staff2, tblReturnData.MEA_PD_Desc3, " _
  21.         & "tblReturnData.MEA_PD_Staff3, tblReturnData.MEA_PD_Desc4, tblReturnData.MEA_PD_Staff4, ALL_SCHOOLS.REGION_ID " _
  22.         & "FROM ALL_SCHOOLS INNER JOIN (ALL_CAMPUSES INNER JOIN tblReturnData " _
  23.         & "ON (ALL_CAMPUSES.SCHOOL_NO = tblReturnData.SchoolNo) AND (ALL_CAMPUSES.CAMPUS_NO = tblReturnData.CampusNo)) " _
  24.         & "ON (ALL_SCHOOLS.SCHOOL_NO = tblReturnData.SchoolNo) AND (ALL_SCHOOLS.SCHOOL_NO = ALL_CAMPUSES.SCHOOL_NO) "
  25.         strSQL = strSQL & Region
  26.         'variable Region is from the report's OpenArg and looks like this
  27.         ' "WHERE (((ALL_SCHOOLS.REGION_ID)=" & Region & "))"
  28.         Set rsData = SurvDB.OpenRecordset(strSQL, dbOpenDynaset)
  29.         Set rsCourses = SurvDB.OpenRecordset("tblCourses", dbOpenDynaset)
  30.         rsCourses.MoveLast
  31.         rsCourses.MoveFirst
  32.         ReDim DisplayData(3, rsCourses.RecordCount)
  33.         'Put an asterisk in (0,0) in case recordset is empty
  34.         DisplayData(0, 0) = "*"
  35.         If rsData.EOF Then GoTo rtn:
  36.         'rs not empty so put title in (0,0)
  37.         DisplayData(0, 0) = "MEA PD"
  38.         rsData.MoveLast
  39.         rsData.MoveFirst
  40.         '   DisplayData(0=Column Head 1=Course Name 2=Pri Numbers 3=Sec Numbers, Number of courses in tblCourses)
  41.         DisplayData(1, 0) = " Pri"
  42.         DisplayData(2, 0) = " Sec"
  43.         strField = "MEA_PD_Desc"
  44.         strStaff = "MEA_PD_Staff"
  45.         For cntCourse = 0 To rsCourses.RecordCount - 1
  46.             rsCourses.AbsolutePosition = cntCourse
  47.             For cntData = 0 To rsData.RecordCount - 1
  48.             rsData.AbsolutePosition = cntData
  49.                 For Counter = 1 To 4
  50.                     If rsData.Fields(strField & Format(Counter, "@")) = rsCourses!course Then
  51.                         Select Case rsData!Campus_Type
  52.                             Case "Primary"
  53.                                 DisplayData(1, cntCourse + 1) = DisplayData(1, cntCourse + 1) + rsData.Fields(strStaff & Format(Counter, "@"))
  54.                             Case "Secondary"
  55.                                 DisplayData(2, cntCourse + 1) = DisplayData(2, cntCourse + 1) + rsData.Fields(strStaff & Format(Counter, "@"))
  56.                             Case "Pri/Sec"
  57.                                 Select Case rsData!PriSecReturnAs
  58.                                     Case "Primary"
  59.                                         DisplayData(1, cntCourse + 1) = DisplayData(1, cntCourse + 1) + rsData.Fields(strStaff & Format(Counter, "@"))
  60.                                     Case "Secondary"
  61.                                         DisplayData(2, cntCourse + 1) = DisplayData(2, cntCourse + 1) + rsData.Fields(strStaff & Format(Counter, "@"))
  62.                                 End Select ' PriSecReturnAs
  63.                         End Select ' Campus type
  64.                         If Match = 0 Then
  65.                             DisplayData(0, cntCourse + 1) = rsData.Fields(strField & Format(Counter, "@"))
  66.                             Match = Match + 1
  67.                         End If
  68.                     End If
  69.                 Next Counter
  70.             Next cntData
  71.             Match = 0
  72.         Next cntCourse
  73. rtn:
  74.         ReturnVal = True
  75.  
  76.     Case acLBOpen
  77.         ReturnVal = Timer
  78.  
  79.     Case acLBGetRowCount
  80.         ReturnVal = rsCourses.RecordCount + 1
  81.  
  82.     Case acLBGetColumnCount
  83.         ReturnVal = 3
  84.  
  85.     Case acLBGetColumnWidth
  86.         ' -1 uses default, other values in twips (567 per cm)
  87.         ReturnVal = ColWidth(col)
  88.  
  89.     Case acLBGetValue
  90.         ReturnVal = DisplayData(col, row)
  91.  
  92. End Select
  93.  
  94. FillMEA = ReturnVal
  95.  
  96. End Function
  97.  
  98.  
Dec 3 '07 #10
JustJim
407 Expert 256MB
And to export to Excel (note lots of rem'd out lines which can be used for formatting)
Expand|Select|Wrap|Line Numbers
  1. Function ExportExcelData(arData() As Variant, fileNameWithPath As String)
  2. Dim objExcel As New Excel.Application
  3. Dim strRange As String
  4. If objExcel Is Nothing Then
  5.     MsgBox "Could not start Excel."
  6.     Screen.MousePointer = vbNormal
  7.     GoTo CleanUpAndLeave
  8. End If
  9. Dim wb As Workbook
  10. Dim ws As Worksheet
  11. Dim iX As Long
  12. Dim iY As Long
  13. 'Dim strBottomRight As String
  14. Set wb = objExcel.Workbooks.Add
  15. Set ws = objExcel.Worksheets.Add
  16.  
  17.     For iY = 1 To UBound(arData, 2) + 1
  18.         For iX = 1 To UBound(arData, 1) + 1
  19.             ws.Cells(iY, iX).Value = arData(iX - 1, iY - 1)
  20.             'Debug.Print iX
  21.         Next iX
  22.         'Debug.Print , iY
  23.     Next iY
  24. 'ws.Range("A1").Font.Size = 12
  25. 'ws.Range("A3").Font.Italic = True
  26. 'ws.Range("A4:B4").Font.Bold = True
  27. 'strRange = "B7:P" & CStr(iY - 3)
  28. 'With ws.Range(strRange).Borders(xlInsideVertical)
  29. '    .LineStyle = xlContinuous
  30. '    .Weight = xlThin
  31. '    .Color = vbBlack
  32. 'End With
  33. ws.Columns.HorizontalAlignment = xlLeft
  34. ws.Columns.AutoFit
  35. 'ws.Rows(4).Font.Bold = True
  36. 'ws.Columns(2).ColumnWidth = 40
  37. ws.Columns(1).ColumnWidth = 30
  38. 'ws.Columns(13).ColumnWidth = 4
  39. ws.Columns(1).WrapText = True
  40. 'ws.Columns(2).WrapText = True
  41. ws.PageSetup.Orientation = xlLandscape
  42. wb.SaveAs fileNameWithPath
  43.  
  44. CleanUpAndLeave:
  45. objExcel.Quit
  46. Set objExcel = Nothing
  47. Set wb = Nothing
  48. Set ws = Nothing
  49. DoCmd.SetWarnings True
  50. DoCmd.Hourglass False
  51. Exit Function
  52.  
  53. End Function
  54.  
Dec 3 '07 #11
sierra7
446 Expert 256MB
WOW !
I see why you are rated a Programmer although I was chuffed that I managed to follow most of the code!

I've tended to avoid multi-dimensional arrays since using Access and prefer to append data in a temporary (local) table if I want it for onward processing. (e.g. charting) It has the advantage that when things go wrong you can inspect the values you are working with, whereas when a lot is held in memory (be it arrays or correleted sub-queries) all is lost if the code breaks. There are many pros and cons for each, I know.

I still have not fully got my head around why you want a list box and why the same data could not be shown in a sub-form from which the Print Preview command could be given. (Temporary table behind the sub-form?)

I'm getting out of my depth (and must go and earn a buck of my own!) Best of luck.
Dec 4 '07 #12
JustJim
407 Expert 256MB
WOW !
I see why you are rated a Programmer although I was chuffed that I managed to follow most of the code!

I've tended to avoid multi-dimensional arrays since using Access and prefer to append data in a temporary (local) table if I want it for onward processing. (e.g. charting) It has the advantage that when things go wrong you can inspect the values you are working with, whereas when a lot is held in memory (be it arrays or correleted sub-queries) all is lost if the code breaks. There are many pros and cons for each, I know.

I still have not fully got my head around why you want a list box and why the same data could not be shown in a sub-form from which the Print Preview command could be given. (Temporary table behind the sub-form?)

I'm getting out of my depth (and must go and earn a buck of my own!) Best of luck.
Thanks for your kind words, although as I said earlier, I may be being too smart for my own good. For the reasons you mentioned above as well as something Adezii has brought to our attention recently.

Anyway, as you say, back to working for the man! Gotta eat.

Jim
Dec 5 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Peter Kwan | last post by:
Hi, I believe I have discovered a bug in Python 2.3. Could anyone suggest a get around? When I tested my existing Python code with the newly released Python 2.3, I get the following warning: ...
4
by: Joe Peterson | last post by:
I could not find another example of this via internet searches, so here it is... I am wondering if this is a python bug or otherwise. The first example of this happened in a larger program of...
3
by: Paradigm | last post by:
I have a contract document that is about 20 pages long with various data base fields in it. I cannot create an Access report that long so I have had to do it as 5 seperate reports. There are some...
0
by: Rahul Chatterjee | last post by:
Hello All I have designed a dotnet application using VB which basically takes a selection and passes value to a crystal report which in turn passes the value to a Stored procedure. After the...
4
by: prashanth | last post by:
we have a Asp.net application which is used to generate the reports. In this application there are some reports which takes more than 50 minutes of the time.these reports works fine on development...
0
by: John Smith | last post by:
Hello, I have 7 different crystal reports that need to be collated. Since I want to end up with a page of each (which all together make a single report), I created a blank main report and then...
2
by: rob | last post by:
Hi, I'm a bit confused by the mapping of the native types int and long to UInt32. I'm trying to bind a tracking reference to a native value type and it works for Int32 % -int but not for Int32 %...
73
by: Yevgen Muntyan | last post by:
Hey, I was reading C99 Rationale, and it has the following two QUIET CHANGE paragraphs: 6.5.3.4: "With the introduction of the long long and extended integer types, the sizeof operator may...
5
by: CarrieR | last post by:
I am working within a DB I have been devolping in Access 2003, and have encountered a report coding issue I was hoping someone could help me with: I have 18 reports, each running off some smaller...
21
by: kurai hikari | last post by:
i have a combobox from table( specialization) and i have a reports from table (managers) the combobox name is( combo1) the selections in the combo box are managersjob governorsjob...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.