473,507 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print subform data or load to report Access 2003

Dököll
2,364 Recognized Expert Top Contributor
Hey Gang!

I am at work, will attempt to make it brief:-)

Looks like I am unable to print subform data results. When the subform loads with the results I want, say from 9,000 records, I get 100 + out of that. I can't seem to print just the results or preview in a report. I know I've missed something. Searched here did not find anything, please point me to it!

Here's a modifcation of the code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub MeReportLoad_Click()
  3. On Error GoTo Err_MeReportLoad_Click
  4.  
  5.     DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
  6.     DoCmd.OpenForm "MyResultsForm", acNormal
  7.     'DoCmd.OpenReport "MyResultsReport", acNormal
  8.  
  9.  
  10. Exit_MeReportLoad_Click:
  11.     Exit Sub
  12.  
  13. Err_MeReportLoad_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_MeReportLoad_Click   
  16. End Sub
  17.  
  18.  
Thanks!
Jul 11 '07 #1
7 2166
kepston
97 Recognized Expert New Member
Try opening the report with a filter/criteria
Jul 19 '07 #2
hyperpau
184 Recognized Expert New Member
Try opening the report with a filter/criteria
Have that report bound to a query and add parameters (criteria to the query)
Everytime the report loads, it would ask you the criteria of the results you want to have. you type that criteria and ther you go. Only those that matches your criteria would be shown on the report.
Jul 19 '07 #3
Dököll
2,364 Recognized Expert Top Contributor
Have that report bound to a query and add parameters (criteria to the query)
Everytime the report loads, it would ask you the criteria of the results you want to have. you type that criteria and ther you go. Only those that matches your criteria would be shown on the report.
Very helpful advice, I have had my nose in it for quite a bit, but I know it is possible, just have to put my finger on it. I am going to now try what you proposed. Though I must admit, I tried:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. SELECT CategoryCriteria.InquiryType, DataCentral.Business, DataCentral.BusinessNum, DataCentral.SDate, DataCentral.Comment, StatusCriteria.Status, PersonCriteria.NowUser, DataCentral.TodayDate
  4.  
  5.  
  6. FROM PersonCriteria RIGHT JOIN (StatusCriteria RIGHT JOIN (CategoryCriteria RIGHT JOIN DataCentral ON CategoryCriteria.InquiryType = DataCentral.InquiryType) ON StatusCriteria.Status = DataCentral.Status) ON PersonCriteria.NowUser = DataCentral.NowUser
  7.  
  8.  
  9. WHERE (((CategoryCriteria.InquiryType)=[Forms]![DataCentral]![Category Criteria]) AND ((StatusCriteria.Status)=[Forms]![DataCentral]![Status Criteria]) AND ((PersonCriteria.NowUser)=[Forms]![DataCentral]![Person Criteria]) AND ((DataCentral.TodayDate) Between [Forms]![DataCentral]![BeginningDate] And [Forms]![DataCentral]![EndDate]));
  10.  
  11.  
This code gets me what I want because I have listboxes to select from. I attempted having the same query use Or to see if anything would pop up, I got nothing.

A VBA code is currently querying my table, the report gets its data from the subform. The subform seems to load a record number I don't want:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub SearchMeData_Click()
  3. Const cInvalidDateError As String = "Please enter date in proper format to continue..."
  4.     Dim strWhere As String
  5.     Dim strError As String
  6.     strWhere = "1=1"
  7.     If Not IsNull(Me.NowUser) Then
  8.         strWhere = strWhere & " AND " & "DataCentral.[NowUser] = '" & Me.NowUser & "'"
  9.     End If
  10.     If Not IsNull(Me.PrevUser) Then
  11.         strWhere = strWhere & " AND " & "DataCentral.[PrevUser] = '" & Me.PrevUser & "'"
  12.     End If
  13.     If Nz(Me.Status) <> "" Then
  14.         strWhere = strWhere & " AND " & "DataCentral.[Status] = '" & Me.Status & "'"
  15.     End If
  16.     If Nz(Me.InquiryType) <> "" Then
  17.         strWhere = strWhere & " AND " & "DataCentral.[InquiryType] = '" & Me.InquiryType & "'"
  18.     End If
  19.  
  20.  
then adds results to a subform. What I am hoping to do is grab the results from this subform and print or preview in a report. It's driving me wild...

Thanks for your reply...
Jul 21 '07 #4
kepston
97 Recognized Expert New Member
Very helpful advice, I have had my nose in it for quite a bit, but I know it is possible, just have to put my finger on it. I am going to now try what you proposed. Though I must admit, I tried:
A VBA code is currently querying my table, the report gets its data from the subform. The subform seems to load a record number I don't want:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub SearchMeData_Click()
  3. Const cInvalidDateError As String = "Please enter date in proper format to continue..."
  4.     Dim strWhere As String
  5.     Dim strError As String
  6.     strWhere = "1=1"
  7.     If Not IsNull(Me.NowUser) Then
  8.         strWhere = strWhere & " AND " & "DataCentral.[NowUser] = '" & Me.NowUser & "'"
  9.     End If
  10.     If Not IsNull(Me.PrevUser) Then
  11.         strWhere = strWhere & " AND " & "DataCentral.[PrevUser] = '" & Me.PrevUser & "'"
  12.     End If
  13.     If Nz(Me.Status) <> "" Then
  14.         strWhere = strWhere & " AND " & "DataCentral.[Status] = '" & Me.Status & "'"
  15.     End If
  16.     If Nz(Me.InquiryType) <> "" Then
  17.         strWhere = strWhere & " AND " & "DataCentral.[InquiryType] = '" & Me.InquiryType & "'"
  18.     End If
  19.  
  20.  
then adds results to a subform. What I am hoping to do is grab the results from this subform and print or preview in a report. It's driving me wild...

Thanks for your reply...
Have you tried
Expand|Select|Wrap|Line Numbers
  1.     DoCmd.OpenReport stDocName, acPreview, , strWhere
Jul 23 '07 #5
Dököll
2,364 Recognized Expert Top Contributor
Hello there!

Thanks for posting, I have tried what you suggested K. I get a report but with all 9,000 + rows of data in the actual/mothership table. With above command, the results are added to a subform. What I want is when I get results on that subform, that whatever the result is to preview it in a report, not the whole information.

I'll just bet it's right under our noses and we can't see it.

I am at work now, I am adding the data to subreport rather, then fish the subreport out of my footer, change the code, to see if report loads by itself and not within the main form's footer. Wish me luck:-)

Again, much appreciatred assistance, it's nice...
Jul 23 '07 #6
kepston
97 Recognized Expert New Member
Hello there!

Thanks for posting, I have tried what you suggested K. I get a report but with all 9,000 + rows of data in the actual/mothership table. With above command, the results are added to a subform. What I want is when I get results on that subform, that whatever the result is to preview it in a report, not the whole information.

I'll just bet it's right under our noses and we can't see it.

I am at work now, I am adding the data to subreport rather, then fish the subreport out of my footer, change the code, to see if report loads by itself and not within the main form's footer. Wish me luck:-)

Again, much appreciatred assistance, it's nice...
Good Luck!
Is the report based on the same query as the subform?
We just need to get the same criteria for the report as on the subform.
(I know that sounds easy :))
Jul 23 '07 #7
Dököll
2,364 Recognized Expert Top Contributor
Yup!

They're all interlinked Query - Report - Subform, and yes it does seem easy written down:-)

Thanks!
Jul 24 '07 #8

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

Similar topics

1
3118
by: Randy | last post by:
I have tried the code to attach a button to a form and use the help information on coding, but I can't seem to get it to work. I have a main form called MAIN CLIENT INFO2 There is a subform...
8
4877
by: stemo76 | last post by:
I have created a report with subform/subreports. I can see all the data on the screen but when I try to print it to a printer or adobe distiller I get 'The Microsoft Jet Database engine could not...
12
3510
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
1187
by: evilbungle | last post by:
Good Morning, I am trying to build an application that will take the details from an access database and use them as log in details but I can not get the App to open the table as I keep getting...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
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...
1
7031
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
7485
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...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.