Printing Current Record
Nov 20, 2006
This could go in forms or reports, I think but:
I have a database which I am developing over time as I see ways of improving it and as I learn bits of vba. My current problem relates to invoicing (that I have probably created for myself!): I currently have two invoice report layouts because of different invoicing addresses.
I now want to add a cmd button to my invoice entry form that will firstly preview, then print the current record. I found elsewhere in the forum a way of previewing just the current record by way of specifying in the underlying qry the ClientID so that it selects the record displayed on the form.
I have this line of code which then previews the invoice:
DoCmd.OpenReport "rptInvoicePrivateClients", acViewPreview
This does not take account, though of the different invoice layouts.
I think strictly speaking I should only have one invoice report, but what I want to say is this:
If the client is a private client, then preview rptInvoicePrivate,
Else preview rptInvoiceLocumWork
I have tried entering this code that does not work
If SolicitorID = "1" Then
DoCmd.OpenReport "rptInvoicePrivateClients", acViewPreview
Else
DoCmd.OpenReport "rptInvoiceLocumWork", acViewPreview
End If
It comes back with a message that SolicitorID is not defined, but I have included Option Explicit.
Any help please
View Replies
ADVERTISEMENT
Jul 19, 2007
Hi Everyone,
I'm probably going about this the wrong way all together, but what I'm trying to do is print a single record from a form in a report.
Basically after the client fills in the form they can print their "results report" using the click box (command button) in the bottom corner of the form. When the client clicks on the button it prints all the records ("result reports") of all the clients...no good of course.
Here's the code for the button:
Private Sub PrintSingleChamber_Click()
On Error GoTo Err_PrintSingleChamber_Click
Dim stDocName As String
stDocName = "SingleChamberPrintOut"
DoCmd.OpenReport stDocName, acNormal
Exit_PrintSingleChamber_Click:
Exit Sub
Err_PrintSingleChamber_Click:
MsgBox Err.Description
Resume Exit_PrintSingleChamber_Click
End Sub
Can someone point me in the right direction? :confused:
Thanks again,
Mark
View 1 Replies
View Related
Jan 11, 2006
Hello,
I have done a search on this forum and found all the postings relating to printing only the current record for a report. I have a command button and have followed what these posts say. The report prints the current record but leaves out the data from the subform.
The database is a recipe organizer. The main form is called Recipes and the subform contains the ingredients for each recipe. This subform is called Ingredients.
I set up a command button with the following code:
Private Sub Print_Recipe_Click()
On Error GoTo Err_Print_Recipe_Click
Dim stDocName As String
stDocName = "Family Recipes"
DoCmd.OpenReport stDocName, acNormal, , "[RecipeID] = " & Forms!RECIPES![RecipeID]
Exit_Print_Recipe_Click:
Exit Sub
Err_Print_Recipe_Click:
MsgBox Err.Description
Resume Exit_Print_Recipe_Click
End Sub
Since the RecipeID is used in both forms and the report, I thought it would be the best field to use since it linked all the information together.
So what do I need to do so that the subform data prints out on the report?
Thanks
GeekyGirl
View 3 Replies
View Related
Oct 21, 2006
I currently am trying to print the current record that I have selected on my form and the subform that I have on the same page. If I try to print selected record it will only print out the main form correctly and will print out the first record on the sub form. I have tried to make a reprot of the current form and it only will do the main form and nothing from the sub form. I am willing to try whatever method would work in getting this to work. Thanks
View 2 Replies
View Related
Nov 23, 2006
Hi All,
Having a problem with a report, I have a form that i use to enter a new record to my database, what I want to do is put a button at the bottom of the form to print the record (via a report)
If I base this on a record that already exists, it works fine.
However,
If I have just entered the record the query the report runs off doesn't see the new record. To print that record I have to exit the completed record, then go back in to it and print.
My aim is to remove this additional part of the process, I'm sure it's something really simple, but can anyone help?
Many Thanks
Paul
View 2 Replies
View Related
May 31, 2014
I have made a navigation form that prints the current record out as a PDF and also the option to send the current record by email as a PDF. Both work perfect when you open the form outside the navigation form. But when you open it inside the navigation form, it does not print any of the information.
The problem is in the Query report, In the criteria box for field [RequsetID] it has
Code : [Forms]![FRMRequestForm]![RequestID]
(The above works outside the navigation form.)
I have also tried adding the navigation form name
Code : [Forms]![Main]![FRMRequestForm]![RequestID]
But none work.
View 4 Replies
View Related
Sep 11, 2013
I have a button on a FORM to print the current record with the following code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection
But what I need is that before printing, open the preview to set the margins and page size ... or at least to pre-configure so that when you press the button, and comes preformatted.
View 2 Replies
View Related
Aug 29, 2007
Hi Guys (again),
Hope you can help and I'll explain this as well as I can but I've put it in general as it's a culmination of things.
I have written a call monitoring database for a call centre (all good so far), but they want historical searches (again all good). I've written the relevant queries for these so that the searches can be done for Adviser, Manager and also by a date range. However, they now want to be able to print out the current search from the screen.
The way I have done it is this. I have written the report be adding in a subreport and putting in the relevant historical search form, and then written a macro that is assigned to a button on the historical search form to print the current record.
The problem that I am having is that when they click on the button to give them the history they fill in the relevant advisor or manager name and the date range which gives them the info in form format but, when they click on the button to print the current 'screen' if you like, it asks for the information again. I know this is because the actual report is written from the same query but is there anyway that it will just print what's displayed on the screen? I don't do VBA so if it has to be done that way could you please display it as it should be inserted.
I do hope that that has made sense and that someone can at least help me, cos you're all wonderful and I've had some really excellent help in the past from this site.
Thanks in advance.
Donna x :confused: (as always)
View 1 Replies
View Related
Dec 29, 2006
When I print queries (and maybe forms) I would like to have the date printed on the sheet so I know when I printed it out. How should I do this??
Thanks
View 4 Replies
View Related
Jan 7, 2014
I have a main form with a subform. The subform has linked tables from the main form. People are on the main form with the index PersonId and they are linked to incidents by IncidentId.
I want to put in two buttons.
First put a print report button for each subform whereby it will only produce a report for the records I can see on screen . i.e. if a person is linked to two incidents I just want the report for those two incidents.
Secondly I would also like a print all button on the subform where it prints reports containing the current IncidentId number.
View 2 Replies
View Related
Apr 30, 2007
I need a way to dynamically store a particular value in "field_2" of the CURRENT record depending on whether or not the value of "field_1" of the CURRENT record is identical to the value of "field_1" of the PREVIOUS record within the same table. The table is sorted on "field_1".
So, if the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is also "ABC", then store a value of "PPP" in "field_2" of the current record. IF on the other hand, the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is "XYZ", then store a value of "WWW" in "field_2" of the current record.
I have a report that will use these results to count only the number of records that have a "WWW" in "field_2".
Is this doable, maybe in a query somehow?
I should add that whatever the solution, it needs to be compatible with Access 2000.
View 1 Replies
View Related
Aug 19, 2013
I have two forms both with separate tables
(1) Register and
(2) Payments.
One of the common denominators between them is the URN which is auto-populated as it is an auto number field. My issue is that when I want to add a new record to the payments table using the forms (I can get to the payments form via the register form), I want to be able to identify the record that I am currently viewing within the register and auto populate the URN field with the same number. This is what I have done so far,
Option Compare Database
Option Explicit
Private Sub AttachPaymentDetails()
Call PerformInsert("tblFinancialBudget", "frmFinancialBudget")
End Sub
[code]....
View 5 Replies
View Related
May 6, 2015
I'm trying to make a form that shows what the last record was next to the empty space where you enter a new record.
This is so the user knows that what they are entering is roughly in line with what has come before.
So for example if I was recording temperature every May, I would like a form that has a field called temperature and next to that field I would like to see last year's temperature.
Records:
Date | Temp
2014 | 20.5
2013 | 18.5
2012 | 19.0
2011 | 22.7
2010 | 15.2
So when I enter the record for 2015 I have a box that says: Temp and next to that box is "Last year was 20.5" or something like that.
View 2 Replies
View Related
Aug 8, 2014
I'm struggling with a query to evaluate current and prior record data. I have a query producing 5000 records. I need to group records by Case ID and compare current date record to previous date record to determine if a team and worker name has changed during the year. I need to count how many times a cases is transferred to and out of a particular team from the beggining of the year. i.e., On 1/1/2014-Team1 has an inventory of 500 cases.
During the month 25 cases are transferred into Team1 and 15 cases are transferred out of Team1. So on 2/1/2014 Team1 begins with an inventory of 510 cases. Throughout the year cases come and go from and to Team1 each month so need to figure out how to create a query to count each change. See attachment displaying how the data is listed and how I invision it to work with the In/out column counts.
Specifically, at the begginig of the year (1/1/14) for case ID 1003 you can see it belongs to Mary in Team1 for January and February. Then in March the case is transferred out and went to Joe in Team 3. So for Mary a "-1" is recorded as a negative count for that Case ID. If later in the year the case is transferred back to Mary a "+1" would be recorded. Respectively evaluated for each of the 5000 records to get a total count for each of the teams by Case ID throughout the year.
I've started with DLookup, tried comparing current month to previous month using DMax. It works as long as I only select one case ID used in a separate query but if I use the whole subset (5000 records) it fails. I can't figure out how to group each set of case IDs and then apply the query.
My attempted query: DLookUp("[Team]","[Team_qry]","[Team_qry]![Date]=#" & CStr(DMax("[Date]","[Team_qry]","[Team_qry]![Date] <#" & CStr([Date]) & "#")) & "#")
View 3 Replies
View Related
Dec 3, 2004
Hi all! Going ga-ga over this, :eek: so please see if you can help!
Access 2000 by the way.
I've a really pretty form made up and it has 3 tabbed pages.Each page contains some fields which contain 'memo' data, so the entries in each field are pretty long.
When I try and print the record e.g. File->Print->Print selected record...it just
a)prints the front page/tab, as opposed to the contents of all 3 tabs
b)Truncates the data in the memo fields...it seems to just print the image of what you see when you open the form up - rather than printing the actual content of each field.
Similar thing when I try and print from datasheet view. Or from the table that the form feeds into.
What am i doing wrong? Please help! :D
View 1 Replies
View Related
Dec 3, 2004
Hi all! Going ga-ga over this, :eek: so please see if you can help!
Access 2000 by the way.
I've a really pretty form made up and it has 3 tabbed pages.Each page contains some fields which contain 'memo' data, so the entries in each field are pretty long.
When I try and print the record e.g. File->Print->Print selected record...it just:
a)prints the front page/tab, as opposed to the contents of all 3 tabbed pages
b)Truncates the data in the memo fields...it seems to just print the image of what you see when you open the form up - rather than printing the actual content of each field.
Similar thing happens when I try and print from datasheet view. Or from the table that the form feeds into.
What am i doing wrong? Please help! :D
View 1 Replies
View Related
Jul 15, 2005
I'd like to put a command button on a form that would run a designated report but have the option of only printing selected records. I know I could just use the File/print option using selected records but that only prints the record fields displayed in the form. I want to run a special report that formats and prints more of the records fields. The problem is how have that report print the "currently selected" record or records.
Thx.
View 4 Replies
View Related
Jul 24, 2014
I am looking to set up a database where I have a table of records that correspond labels to product numbers. The product numbers may have anywhere from 1 to 30 labels that correspond to them, and I want the user to have a form where they search by a product number and then the labels that correspond to that product number are printed out on an Avery label.
Here is how the main data table will look: (everything is simply arbitrary to illustrate)
For example: If I type in "1111" into the form - the labels that print would be AA, AB, AC, AD, & AE
I know how to set up labels to print using forms, but the only way I can think of this working is by looking up the product number in the table, then copying the row of labels into another table (let's call it "labels to print") and pasting them in a column, then printing to the labels, and clearing the "labels to print" table for the next time.
Is this the correct route to go? If so, how do I go about looking up the product number in the main table and copy them to the "labels to print table".
View 6 Replies
View Related
Sep 15, 2005
In my query, i want to automatically display the value of another field from the previous record in a field in my current record. i.e.
Name Value Previous
Record 1 1
Record 2 2 1
Record 3 7 2
Record 4 1 7
Is it possible to create some kind of simple expression to refer to data in another record?
Cheers,
Ben
View 6 Replies
View Related
Apr 14, 2007
I need to write a query which populates an empty field in the current record with information from a specific field in the next sequential record. Any ideas?:confused:
View 3 Replies
View Related
May 1, 2013
I have a query to bring in values, I need to select 2 rows of data but the criteria is as such:
x= starting value on form
now the row of data must match the following criteria previous row to current row(ref temp)<=x And Current row(ref temp)>xnext row to current row(ref temp)>=x And Current row(ref temp)<x
I have dealt with SQL before but how to do the above.The isolated 2 rows of data will then go into unbound boxes on a form from which I will do intercept and gradient calculations.
View 5 Replies
View Related
Jan 6, 2005
I have a form which is used for data entry for a new record only. I then wish to print some of this record's details on a report, using a command button on the form. At present I cannot filter to get just the current records details on the report - I am getting the report containing all records in the table.
Thank you
View 3 Replies
View Related
Jan 7, 2014
I want a textbox on a form to record the time every record is printed. I used the codes below but it couldn't work. Am getting 'runtime error 2147352567 (80020009)'
Private Sub cs3_Click()
Dim mydate As Date
Me.hdates = Now()
DoCmd.Save acDefault
DoCmd.OpenReport "Copy of HH", acViewReport, , "[REF] = " & "'" & [ETGRef] & "'", acWindowNormal
DoCmd.PrintOut
End Sub
View 2 Replies
View Related
Mar 25, 2015
So I created a form for the nursery at my church. It's set up so that they pick their child from a drop down menu (in a separate form), then a form opens up that brings up their child's information. I have a save and print button at the bottom, and I was able to set it up so that it does save the form and close it, but I can't figure out how to get it to print. I need to set it up so that the information displayed is all that is printed (not all the records like it keeps showing in print preview), and print it at a certain size (like a label). Everything I keep finding says to print from a report, but I have it set up as a form.
View 1 Replies
View Related
Apr 14, 2014
I am working on a volunteer organization's database, and am trying to create capacity to print an invoice for a donation pledge. I have a sub-form that displays donation records for a selected individual. From the sub-form I have created a command button with an OnClick event procedure with the following code:
DoCmd.OpenReport "Reports![RadThonInvoiceR]", acViewNormal, , "MasterID= " & Me.MasterID
ID Year Amount Status
53 2008 $200.00 Paid
53 2009 $200.00 Paid
53 2013 $200.00 Unpaid
Can I modify my Where condition so that the report selects only the most recent entry (by Year) from among the current selections?
View 8 Replies
View Related
Nov 7, 2014
After data is entered and exit and print is selected, it doesnt print last record in the table
View 7 Replies
View Related