473,320 Members | 1,838 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,320 software developers and data experts.

Select Report to Print based on Form Entry

I'm back with a new set of problems with the old NCR database from a year ago.

I have a form that is for Nonconformance Entry. In the process of entering this form if the supplier for the nonconforming material is external the entry person clicks a checkbox and a lookup is performed to a pass thru query.

Currently, we print off a Nonconformance report after all data is entered. We have added a new form for external vendors call a Defective Material Report. I need the print button to print off the Nonconformance Report if the external checkbox is not clicked and the Defective Material Report if it is clicked.
Dec 17 '07 #1
6 2552
Rabbit
12,516 Expert Mod 8TB
Ok, so what's the problem?
Dec 17 '07 #2
No problem... Was needing guidance on how to do something. Used the following to resolve the question:
Expand|Select|Wrap|Line Numbers
  1. Private Sub PrintReport_Click()
  2. On Error GoTo Err_PrintReport_Click
  3.  
  4.     Dim stDocName As String
  5. If Me![chkExternal] = True Then
  6.     stDocName = "DMR Form (All)"
  7. Else
  8.     stDocName = "NCR Form (All)"
  9. End If
  10.  
  11.     DoCmd.OpenReport stDocName, acPreview, , "[rptNumber]=[Forms]![FrmMasterEntry]![rptNumber]"
  12.  
  13. Exit_PrintReport_Click:
  14.     Exit Sub
  15.  
  16. Err_PrintReport_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_PrintReport_Click
  19.  
  20. End Sub
Dec 17 '07 #3
Rabbit
12,516 Expert Mod 8TB
Good job!
Dec 17 '07 #4
Thanks!

I now need to know how to make this work if a field in a query is true.

I am trying:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Print_Debit_Memo_Click()
  2. On Error GoTo Err_Print_Debit_Memo_Click
  3.  
  4.         Dim stDocName As String
  5. If [Query]![qryDMRStart]![Scrap] = True Then
  6.     stDocName = "Debit Memo Scrap"
  7. Else
  8.     stDocName = "Debit Memo Rework"
  9. End If
  10.  
  11.     DoCmd.OpenReport stDocName, acPreview, , "[rptNumber]=[Forms]![FrmMasterEntry]![rptNumber]"
  12.  
  13. Exit_Print_Debit_Memo_Click:
  14.     Exit Sub
  15.  
  16. Err_Print_Debit_Memo_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_Print_Debit_Memo_Click
  19.  
  20. End Sub
But it doesn't work.....
Dec 21 '07 #5
jaxjagfan
254 Expert 100+
Thanks!

I now need to know how to make this work if a field in a query is true.

I am trying:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Print_Debit_Memo_Click()
  2. On Error GoTo Err_Print_Debit_Memo_Click
  3.  
  4.         Dim stDocName As String
  5. If [Query]![qryDMRStart]![Scrap] = True Then
  6.     stDocName = "Debit Memo Scrap"
  7. Else
  8.     stDocName = "Debit Memo Rework"
  9. End If
  10.  
  11.     DoCmd.OpenReport stDocName, acPreview, , "[rptNumber]=[Forms]![FrmMasterEntry]![rptNumber]"
  12.  
  13. Exit_Print_Debit_Memo_Click:
  14.     Exit Sub
  15.  
  16. Err_Print_Debit_Memo_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_Print_Debit_Memo_Click
  19.  
  20. End Sub
But it doesn't work.....
Use a DLookup to return the same value your query does or even return the value from the query itself. Otherwise looks pretty good.
Dec 21 '07 #6
Rabbit
12,516 Expert Mod 8TB
Yeah, you'll have to do what jaxjagfan suggested. You can't use Query!QueryName!FieldName or Tables!TableName!FieldName. Those two formats only work with Reports and Forms.
Dec 21 '07 #7

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

Similar topics

1
by: hawk | last post by:
I am creating a series of custom reports, whose parameters are specified through combo boxes in a form, which then generates a custom report based on a series of calculation queries. My problem is...
6
by: John | last post by:
Hi, I have simple database based on 3 tables. Relationship is 'one to many' between table 1 and 2, also between 2 and 3 table'one to many'. I have made form where I enter data in all 3 tables....
3
by: Glenn Zamora | last post by:
I am new to MS Access. I have created a simple entry form to track patient information. I have also created a Patient Report that prints Patient Information with a standard disclaimer statement. I...
1
by: bruce | last post by:
Hello, I have a small form that pops up when a user moves off the current record of a rather sizeable data entry form. The purpose of this form is to list warnings about various fields on the...
5
by: ChadDiesel | last post by:
My basic question is why does my print report button on my subform print a blank report when my cursor is on a blank entry line? Here is a more detailed explanation of my problem. I have a...
3
by: syounger | last post by:
Hi. I have a report in Access 2000 that is based on selection made from a series of interdependent list boxes. The boxes I have right now are Source, Table, Column, Date. The user chooses Source...
1
by: Stinky Pete | last post by:
Evening, I have a form that uses 5 pages (it's an electronic copy of the paper version) we are going to use for manufacturing non conformances and product deviations. In case your wondering,...
16
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.