Printing A Report Based On The Current (new) Record
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?
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
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:
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.
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
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
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
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.
I have a drop down list on a form that prints a report based off of the selection in the cbo box...
(I have already changed the query and relationship for the lookup and maintable)
Here is the code that works fine,(this is on a command button)
Private Sub cmdViewStreet_Click() stDocName = "rptStreetName" On Error Resume Next DoCmd.OpenReport "rptStreetName", acViewPreview, acEdit Me.cboStreetName = Null End Sub
What I am doing now.. is this: the look up table that had the street names but did not have an autonumber or primary key. I added in a autonumber and primary key. I can get the cboStreetName to list the street names and not the autonumber.. and I can get the main table to store the autonumber not the street name (this is what I want).. but now I can't get it to view what is in the cboStreetName... When I hit the view button it does nothing... Any suggestions?? If you need more info please let me know...
I tried something like this to:
Private Sub cmdViewStreet_Click() On Error GoTo Err_cmdViewStreet_Click Dim stDocName As String stDocName = "rptStreetName" DoCmd.OpenReport "rptStreetName", acPreview, , "[StreetName]=" & Me.cboStreetName.Column(0) Exit_cmdViewStreet_Click: Me.cboStreetname = Null Exit Sub
I am trying to print a report based on the filtered results of a form where the data record source is generated from a query. What I have is five unbound comboboxes on a form that filter the results of the query on a subform which works fine in whichever combination I set, I then want the report to print out the results of the filter and the filter combination that I used - basically exactly as it appears on the form (I have used the same query / subform in the report with text boxes to show the filters used on the form). My VBA skills are quite limited (but improving!) and I have trawled the web trying different code examples but can't seem to get it nailed. Current filter code follows;
Code: Option Compare Database Option Explicit Private Sub PrntConfigReport_Click()
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.
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.
I am designing a contact management system and have hit a bit of a wall. I am farily new to Access so please advise if I am going about this the totally wrong way.
I have three tables; Contacts, Companies, Company_Addresses
Contacts: ContactID (P) CompanyID OfficeName
Companies: CompanyID (P)
Company_Addresses: CompanyID OfficeName (P)
What I want is when adding a contact, to have a drop down list in the CompanyID field showing all the companies in the Companies table, and then in the OfficeName field, have a list of only the offices related to the company selected in the previous field.
I can do the first list, but cant work out how to list only data related to the company selected in the previous field. Any help would be greatly appreciated.
I am designing a contact management system and have hit a bit of a wall. I am farily new to Access so please advise if I am going about this the totally wrong way.
I have three tables; Contacts, Companies, Company_Addresses
Contacts: ContactID (P) CompanyID OfficeName
Companies: CompanyID (P)
Company_Addresses: CompanyID OfficeName (P)
What I want is when adding a contact, to have a drop down list in the CompanyID field showing all the companies in the Companies table, and then in the OfficeName field, have a list of only the offices related to the company selected in the previous field.
I can do the first list, but cant work out how to list only data related to the company selected in the previous field. Any help would be greatly appreciated.
right, struggling here. Basically I have continuous form listing all the standard letters sent out when I double click on a letter, I need to to run a query for me. The code I have put behind the button is: If ([StandardLetterType] = "Homework") Then DoCmd.OpenQuery ("qryHomeworkClearMailMerge") DoCmd.OpenQuery ("MergeHomework"), , , , , acDialog, Me.[StandardLetterID] DoCmd.OpenReport ("rptHomework"), acViewPreview Else ' end if
and in the query I am first clearing the mailmerge yes/no field out which works fine and then running the merge to put the yes back in the current record so the query looks like this
Its an update query with update to yes for mailmerge and under the standard letter ID i have the criteria [Me].[OpenArgs]
is this completely wrong tried the [Forms!][frmFullStudentReport].[standardletterID] but it kept popping the box up asking for the number.
On the form I have the standardletterID and its hidden but there.
I have a form which displays records of our products, on that form I have now put a list box which displays the ancillaries to the products.
both the form and the list box run off queries.
I have the same unique identifiers in both queries.
I need to filter the listbox by the unique identifier every time I move record.
At the moment the list box stays populated with all the ancillaries, how do I filter it programatically to list only the ancillaries with the same unique identifiers as in the current record?
I have got a tricky problem, for which I can find no answer - but then I am a bit of a novice here.
I have created a (probably too-) complicated relational database but what I really need is to be able to make abutton on the page of my address book form, so that when I hit it it creates a report of an address label for that current record on the screen only.
I hope this makes sense. If this is possible, I then need to extrapolate this technique to print a report of a subform (of samples sent) of a current client record.
I need to Print a single record from a form but using a report layout.
I have created the form and created a report. A button on the Form kciks off the print but I get all records rather than just the one shown on the Form. Whats a really simple way of just selecting the Current record.
Where do I put an instruction saying print only this record:confused:
btw, although values will always be in order they may not all be output, so it's not just case of odd, even, odd, even (that would be too easy!)
I can retrieve the Previous Record's GroupNo value (via a function) in another text box and compare current GroupNoID with this in the Format Expressions and manage to change the colour, but it won't sustain this new colour for the subsequent same GroupNos, obviously as the values have changed.
So how can I....
Change the colour when the value changes. Keep this new colour until it the value changes (increases) again.
I am working on converting someones Paradox Database to Access and making some modifications.
I have a table with people in it and they are linked to a number of interests. But i am struggling to create a query so that on each page of the form for the person i can call the interests and display them on the form as a list...
If anyone could point me in the right direction that woul dbe appreciated!
Give me mysql and a bit of php anyday!! hehe
I am using Access 2007 but i have used access before so i should be able to work my way through instructions for 2003.
I currently have a form that only shows data based on a specific record id. I have placed a list into that form though that has multiple record ID's listed ( It's a log). How do I get a List to Filter to just the Record ID that corresponds to the current form Record.
What I have are as follows:
A form that has client information : Address, phone numbers, Etc.
On that form I have Pages. one of the pages contains a List.
That List however contains information from multiple clients based on Point of Contact ( Call Log)
What I want is a way to narrow the List to only show those that corresponds to the Current Client Record.
Is this possible? If my approach is wrong, which is a better way?
I have a report that is tied to a table. On my table form I have a button that prints the report. Is there a way to only print the report for the current record showing on my form?
Private Sub Command30_Click() DoCmd.RunCommand acCmdSaveRecord Dim strDocName As String Dim strWhere As String strDocName = "Civil Process" strWhere = "[FormID]=" & Me!FormID DoCmd.OpenReport strDocName, acPreview, , strWhere DoCmd.RunCommand acCmdPrint End Sub
I can get this code to print only one record but then the button will always print this record. It will not change and print the current record.
FormID is an autonumber to give each record it own id.