Print Report From Form Based On Multiple Criteria?

Nov 17, 2006

Hi,

I have the following code which i found on another thread on this forum (thanks to original author) which is attached to the On Click of a button which prints the report corresponding to the details displayed in the form.

Dim strCriterion As String
Dim strMsg As String, strTitle As String
Dim intStyle As Integer

If IsNull(Me![ReferenceNumber]) Then

strMsg = "You cannot print a Blank Form!!."
strTitle = "Print Error"
intStyle = vbOKOnly
MsgBox strMsg, intStyle, strTitle

Exit Sub
End If

If Me.Dirty Then
Me.Dirty = False
End If

strCriterion = "[ReferenceNumber]=" & Me![ReferenceNumber]
DoCmd.OpenReport "DoC Certificate", acViewNormal, , strCriterion

This works fine, however, i need to be able to select the report based on more than 1 criteria. For example, the Reference Number can be repeated but is distinguishable from each other by an Issue Number i.e. ReferenceNumber = 93, Issue 1 or 2 etc. At present when i run the above it prints all versions of, in this case, reference number 93, which given that each report is only a single page isn't a show-stopper but it would be nice to have it working as i would like.

I have tried adding to the strCriterion line such as strCriterion = "[ReferenceNumber]=" & Me![ReferenceNumber] and "[IssueNumber]=" & Me![IssueNumber] but no joy. I have tried bracketing the whole line and variations thereof, again no joy.

Can anybody tell if what i am attempting to do is possible and if so how do i go about it?

I have tried the above coding using MasterID which is the Autonumber PK but it produces an "Enter Parameter Value" box for MasterID. Obvioulsy if i can get it to work for the Autonumber then my problem goes away but i can't seem to figure out why it works for Reference Number (Number) and not MasterId (Autonumber)?

Regards

Alan

View Replies


ADVERTISEMENT

Forms :: Print Report Based On Subform With Multiple Search Criteria

Jun 14, 2015

I have a problem printing a Subform that uses multiple criteria(in textboxes) as filters.

The search portion of the form works fine. The problem is I have created a report based on the subform and am using the following code to open/filter the report

Code:
Private Sub PrintBtn_Click()
Dim strCriterion As String
Dim strMsg As String, strTitle As String

[Code].....

View 3 Replies View Related

Reports :: Report Based On Multiple Criteria

Jul 27, 2015

I am in the learning phase for MS Access reports. I have a datasheet which contains the employee daily activities.I need a report when either or both criteria is selected. For ex..criteria1 is Start date and End Date and criteria2 is Employee Name.Output of the report should be based on the selection of the criteria ,as I said either or both.

View 3 Replies View Related

Queries :: Query To Run Before Report Based On Criteria Based From Two Combo Boxes On Form

Mar 20, 2013

I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.

View 3 Replies View Related

Reports :: Print Report Based On Filter From Navigation Form

Aug 7, 2013

I am using the Navigation form and I have a tab that has all the sales quotes for a particular salesperson. Because my salespeople like to work with paper I have created sub tabs which contain a report with the same information but filtered based as follows: this Month, this year, and Last year. This report needs to be printable based on the filtered information so I created a print button within the report however when clicked it prints the entire report not the filtered report.

The filter criteria is located in the navigation button, navigation where under the data properties. I have the on click event of the button set to open the report in print preview but I need to know how I filter the where in the macro to read the criteria from the active navigation button property?

View 1 Replies View Related

General :: Button To Print A Report Based On Text Box Values On Form

Jul 11, 2015

Im using a button to print a report based on a text box values on the form.the code for which is below

Code:

Private Sub SaveBtn_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "Update BookInTable SET DateBookedOut = '" & Me!DateTxt & "' WHERE BarCode ='" & Me![BarTxt] & "'"
DoCmd.RunSQL "Update BookInTable SET BookedOut = True WHERE BarCode ='" & Me![BarTxt] & "'"
DoCmd.OpenReport "Labels", acViewNormal
DoCmd.PrintOut , , , , 1
DoCmd.Close acReport, "Labels", acSaveNo
DoCmd.SetWarnings True
End Sub

The problem that I am getting is not only is the label printing but so is the form.

View 3 Replies View Related

Form Based Parameter Query With Multiple Controls Used For One Criteria

Nov 14, 2012

My form-based search mechanism uses controls to set the parameters for the query data source.

I have one field call quantity in stock. I could you a Between and And method to allow the end user to input the stock quantity they want.

HOWEVER, i would love it for the user to first select the Comparison Operator (e.g. > , <, >=, <=) from a combo box and then in an adjacent text box, enter the quantity.

The expression i entered in the query goes something like this.... Forms![frmSearch]![cboRange] & [Forms]![frmSearch]![txtQuantity]

When i try and run this, i get the message "THe expression is too complex to be evaluated".

View 5 Replies View Related

Reports :: Filtering A Report Based On Chosen Criteria In The Form

Mar 12, 2015

I have a report with a table as the row source. I have command buttons that opens different forms and allows the user to choose criteria, the form then filters the report based on the chosen criteria in the form, but if I use the destination city form to filter the report by destination city, then filter the report using a different form, the destination city filter is lost, is there a way to filter the report with a form by say destination city, then further filter that dataset with another form for say location city.

View 14 Replies View Related

Forms :: Preventing Double Booking Of Room In Form Based On Multiple Criteria

Aug 13, 2015

I have Table for rooms called Rooms, and the data in the table is roomNumber which is in the format Letter and two Digit number, so A01 would be dorm building A and room building 1, and I then have a seperate row named roomType that is either VIP or Semi Private.

Now I am creating a form where a worker will put in there scheduledCheckin date and scheduledCheckout date and it will be written to the Bookings table. I would like this form however to take the dates they have put in, as well as room type (Semi-Private or VIP, and assign them an available room that isn't booked at all in that range) or list all available rooms for that range of time and they could then just select the room. I would rather it automatically assigns an available room based on room type though because this check in system is going to have about 500 rooms.

I've attached a link for what I have so far. I know how to make a query to list anyone who has booked rooms over that date, but need one for just preventing booking the same room.

[URL] .....

View 3 Replies View Related

Reports :: Print Only Report Matching Current Record In Form Among Multiple Reports

Oct 2, 2013

I have been an MS Excel man all along my career and I am a novice in MS Access.I have created a table, [Initial Customer Approval] which records data from a Form, [Initial Customer Approval]. Once the data is entered in the Form, I need to do some calculations based on the data entered in some of the fields in the form.I created 6 different queries for the six possible values in those fields. now for each of those queries I created respective reports.I placed a Print command button in the Form.

1. When I press the Print button it should open the report for the current record in the Form. (Currently It Opens all the reports simulatneously, with only one relevant report containing the current record; other opened reports being blank.)

2. If user presses the Print button before pressing Save button then system should prompt user.

Here is the code (Please note [reference number] is the unique ID generated for each record entered in the tabe through form):

Private bSaveClicked As Boolean
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not bSaveClicked Then
MsgBox "You are trying to navigate away from the active record. Please either save your changes, or press ESC to cancel your changes.", vbOKOnly + vbInformation
Cancel = True

[code]...

View 5 Replies View Related

Print A Report Based On Text Box Parameters

Nov 7, 2005

I am trying to create a report based on a table field called "ClassNo".

I would like there to be a pop up that asks for the begining and ending "ClassNo".

View 2 Replies View Related

Print Report Based On Checkbox Selection

Oct 19, 2015

I'm having difficulties with building a printing option for specific goods selected on the list.

I have a form which contains a subform. On the main form user is able to select supplier and based on the supplier can choose article that he's interested in. On the subform user gets the list of all the goods that are connected with that specific article.

I want be able now to select specific goods from subform list (using checkbox value) and based on the selection print a separate label for each goods.

View 4 Replies View Related

Print Specific Report Based On Combo Selection?

Apr 18, 2006

Hi

I need to print a specific form based on the selection made on a combo box.

I have been able to set it up to open the relevant form when the user selects an option from the combo box, but am unable to find a way to be able to print the specific report based on the selection.

I have a command button which prints a report based on the data in my current form, but would like it to also print the specific form based on the combo box selection.

Is this possible, and if so how is it possible?

Thanks in advance,

me

View 5 Replies View Related

Reports :: Print Report Based Upon Auto-number?

Sep 6, 2014

I need VBA code to print a report (rptLoadSheet) when the autonumber field (Auth Num) ends with a zero.

For example:

The autonumber is 99...no report.

The autonumber is 100...print the Load Sheet report.

View 3 Replies View Related

Reports :: Print Report Based On Input Parameter

Jul 2, 2015

I have to print a label quickly every time that the product hit the warehouse. The label has been created as a report linked to the query that will provide the info to the report. In order to make this report printing as quick as possible the idea is to scan the sample id from the product and once the label is printed scan the next sample and an on.

I'm not an expert on VBA but I have created the following scrip but the reports doesn't pop up.

Here is the code:

Dim SampleID As String
SampleID = InputBox("Enter Sample ID")
If SampleID > 0 Then
DoCmd.OpenReport "rptGRM_QuickPrintLabelDymo", acViewPreview, , "[Sample]=" & SampleID
Else
DoCmd.Close
End If
End Sub

View 8 Replies View Related

Queries :: How To Count Records Based On Multiple Criteria From Multiple Tables

Jan 4, 2014

I need to count records based on multiple criteria from two different tables. I have two tables (i.e. "tblTasks" and "tblTaskHistory"). The tables have a one-to-many relationship based on the "TaskID" field. "tblTasks" has a field called "AssignedTo" and "tblTaskHistory" has a field called "TaskStatus". I need to know how many tasks have been "reopened", the "reopened" status is located in the "TaskStatus" field in "tblTaskHistory". I need this count against a unique listing of employees which can be found in the "AssignedTo" field in "tblTasks".

View 4 Replies View Related

Reports :: Unbound Report - Print Preview OK But None Of Fields Print When Report Directly Send To Printer

May 25, 2013

I have an unbound form with an associated report. When the user hits the 'print' button on the form/screen, the report is launched in the background. In the On Load event of the report I populate the report fields from the forms field as so:

Code:
Me.txtAddrMainLine2 = "NAME " & UCase([Forms]![frm_OrderRx].[txtPatientName])

This works like a charm as long as I call the report in Print Preview mode (i.e. with acViewPreview). But if I send the report directly to the printer, none of the fields print.

I've read about using other report events to populate the fields (e.g., On Format and On Print) and also something about using TempVars to pass the data. But I haven't read anything that's clear and definitive about the full answer.

View 3 Replies View Related

Modules & VBA :: Print Report Based On Multi Search Not Working?

Jun 5, 2014

i have created a MultiSearch query witch puts my results in a list box.under it i have created a button wich i want to use to print a report with the criteria i select from my list box if there is more than one result.

Following is the Code i used for my button

On Error GoTo Err_Command60_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ReportLable"
stLinkCriteria = "[ProductID]=" & Me![SearchResults]
DoCmd.OpenReport stDocName, , , stLinkCriteria
Exit_Command60_Click:
Exit Sub
Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click

Every time u press the button i get a message syntax error(missing Operator) in query expression

Now i have not used any code in my Query except for

Like "*" & [forms]![frmSearchFor]![SrchText] & "*"

Where i made the error

View 3 Replies View Related

Modules & VBA :: Print Preview Report Based On Subform Record

Jan 26, 2015

I have a form created from a table that contains item information.

I have a sub form linked to a different table that contains records.

Each item has multiple records associated with it, so for example 1 record on the main form could have 10 records displayed in the sub form.

Example: Main Form :

Item | Units | Serial Number
Thermometer1 | DegC | 123456

Sub Form:

Item | Date | Actual Measurement | Unit Reading

Thermometer1 | 01/01/15 | 25 DegC | 24 DegC
Thermometer1 | 01/01/14 | 25 DegC | 23 DegC
Thermometer1 | 01/01/13 | 25 DegC | 24 DegC
Thermometer1 | 01/01/12 | 25 DegC | 26 DegC
Thermometer1 | 01/01/11 | 25 DegC | 25 DegC

I want to be able to print preview a report based on 1 record record selected in the subform. So using the example above i'd like to print the record on say 01/01/13 as a report that contains all the information from the item table and only the information on the 01/01/13 from the record table.

View 5 Replies View Related

Reports :: Creating A Report Based On Single Record In Multiple Item Form

Jan 8, 2014

I'm currently working on a database which requires invoicing as a part of it. The invoicing is done based on quarters, and I want the users to be able to use a multiple items form, listing all of their clients, to create the invoices. Each invoice must be created individually so they can be e-mailed to the client, and saved to the clients folder. So I was wondering if it would be possible to create individual invoices for clients using a multiple items form.

View 1 Replies View Related

Print Multiple Copies Of A Report Using Macro

Jan 7, 2015

In Access 2007 is it possible to alter a macro so I can print 2 copies of a report. I have created a simple macro which opens up a report based on a value in a data entry form. I want to automatically print 2 copies of the report. Is this possible....

View 1 Replies View Related

Search Based On Multiple Criteria

May 30, 2006

Hi there i am building a search form and I want it to be able to display results from multiple criteria......Currently I am able to display results in a listbox, whenever the user types in a id number in a text box. So if a user types 63 in the ID text box the record with and ID of 63 will appear in the list box or it will wont if the record does not exist..... What i want to do is be able to search on multiple criteria. Sof if a user wants to search based on a name instead of a id number they woudl be able to. What I am struggling to grasp is how to invoke a OR in the criteria box. So that the list box will display results based on either the ID text box OR the name text box.

Any thoughts?

View 1 Replies View Related

Selecting Records Based On Multiple Criteria

Jul 10, 2007

hi,

i am querying a single table that contains card numbers and corresponding transaction codes (amongst other things). a single card number can have multiple transaction codes.

i want to select all card numbers that have both 0100 and 0802 transaction codes.

if i use a select query with ="0100" Or "0802"as the criteria, it returns all card numbers that have either 0100 or 0802 transaction types. if i then change the query to crosstab and group by card number, it is clear that some cards have both transaction types.

when i try to change the criteria to ="0100" And "0802" it returns nothing at all.

i'm sure the solution is something really simple - any idea what i'm doing wrong?

View 7 Replies View Related

Query Based On Multiple Criteria With Check Box's

Nov 18, 2004

I have a table(Product Change) with these fields:
Tracking Number
Approved (a check box)
Engineering (text box that represents department)
Purchasing (text box that represents department)
Quality (text box that represents department)
Production (text box that represents department)
Customer Service (text box that represents department)

I want my query results to show all records that have the "Approved" check box...checked, and then only the records that have one of the Department fields with a null value.
So I'm looking to see only records that are "Approved" and out of those....only the records with at least one department field empty(Null).

Any help doing this is SQL view would be great...or even design view.

View 2 Replies View Related

Queries :: Sum Values Based On Multiple Criteria

Aug 12, 2013

If I want to sum the percentages from April, May and June only if a column is Not Null, how would I do that?

example

Tbl 1
PK, Month
Percent

Tbl 2
FK, Month Enrolled
Qty of Rx in the 1st month enrolled
Qty of Rx in 2nd qtr
Base (if Qty of Rx in 2nd Qtr is null then Qty of Rx in 1st month enrolled)

If Qty of Rx in 2nd QTR is NOT NULL then QTY of Rx in 2nd Qtr * Sum of April Percent+May Percent+June Percent, otherwise Qty of Rx in 1st month enrolled * Month Percent

Im getting stuck on how to sum the percents of April, May and June and then multiplying the result times the Qty ONLY IF the field is not null.

I only know how to create Query's using the design mode. I dont know how to write SQL statements.

View 1 Replies View Related

Forms :: How To Select A Record Based On Multiple Criteria

May 15, 2013

I have a list of client stored in a table "Clients". I would like a form to present a user with the next client in the list at the click of a button, but there will be some exceptions:

Some clients will be given priority, and should be moved to the top of the list although they may not be the next logical entry in the table. Priority clients are indicated by a field "Priority" with a Yes/No option set before work begins.

Some clients will have requested a call at a certain time of the day - This time will be stored in a field named timeToCall. The next user to click the button after the time has passed should be given that clients details.

When the end of the list is reached any clients who could not be contacted will be tried again. My table currently has a field "Attempts" to track this, but that may not be needed. Clients who have been dealt with will be removed from the "Clients" table to a "Completed" table.

Whichever record is selected will be flagged as being dealt with so that 2 people don't get the same entry. I may add a new field for this, but right now I plan to use the "attempts" field to control this

I am unsure of the best approach to the above, I'm not very well-versed in Access, but if I were doing this in Excel (as originally requested by my boss) I would do it like this:

Use a form where the "Next" button will use VBA code to first check if there are any priority clients, then check if there are any timed client's ready to call and then move to the next entry that has had 0 contact attempts. Whichever record is the next one will be displayed in the form to the user.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved