View Full Version : Need Help in printing report with current data
braimi 05-15-2010, 01:53 PM HelloI have a serious issue, please if some one can help me.I have three forms "Owner" main form, "Tenant" Subform and "Trans" Subform in "Tenant" Subform.I also have a report created but I am facing problem in printing single record from current view.Please tell me that how I can do this???Please it is urgent.Thanks
PNGBill 05-15-2010, 03:30 PM If you have a report for all the tenants and it's data source is a query that selects all the tenants and this works then you are just about finished.
If this doesn't work, get your query to produce the data and when that is working get your report to display, total etc, the data the query produces.
Then, on the form where you have just one tenant showing, ie one record displayed, you use your tool box, add a command button to preview the report and you should be given the option to match fields - restrict the data.
Follow the wizard and you should then have your report that worked for all records now just show you one record.
braimi 05-15-2010, 09:38 PM Thanks PNGBill for your reply, but I am still not able to get it work.
Let me clear you about the scenario I have. The three froms I have created from three tables.
Then I link the third table on 2nd table as a subfrom and once it was done I link 2nd table on the main table as subform.
I have no problem with the functionality of the forms as they are working normal and without any error the only problem I am getting is that I can not print only the current record from the form.
I am attaching an empty file containing forms and report for your review so that you can understand it well and be able to help me out more quickly
PNGBill 05-15-2010, 09:57 PM Check your download. Did you remove any tables, forms, reports and queries that are not needed for this issue and leave some bogus data.
Then compact and repair and attach the file. Should be way smaller then 1mb.
braimi 05-15-2010, 10:12 PM I only removed Switchboard thing and rest all the tables and forms are needed which are currently there in the file. I have repaired the file and it is already less than 1mb. I am attaching the file again.
Thanks
PNGBill 05-15-2010, 10:16 PM Downloaded but could not open. Is this an access database file or a backup of same?
Also, I am using access 2000 - bit old but still works. Can you save in this format?
braimi 05-15-2010, 10:24 PM I have converted the file to Access 2000 format and reattaching.
Please check and let me know if it works.
PNGBill 05-15-2010, 10:26 PM It opens. Give a few minutes to look at it.:)
braimi 05-15-2010, 10:27 PM Ok sure... I am waiting for your reply. just for your information that SenderDetails form is the main form.
PNGBill 05-15-2010, 10:39 PM Your form BeneficiaryDetails - Delete the Command28 button you have and add a new button to open the report but this time put the button on the main form. Not the subform.
braimi 05-15-2010, 10:43 PM Ok I have deleted the Command 28 button from the Remittance Details. It was not on BeneficiaryDetails.
And what show I do next after creating a new button on the main form?
PNGBill 05-15-2010, 10:43 PM The report needs to be opened where you have the BeneficiaryID available. You do not have this on your subform or on your remittance details form.
If you can build the beneficiary into this form it may work.
PNGBill 05-15-2010, 10:46 PM see attached file - your report works.
braimi 05-15-2010, 10:47 PM I tried with that before but it didn't work :-(, because a beneficiary can have more than one records in its remittance details. I am sure that there can be some VBA code to achieve this. But I am not getting it. :-(.
PNGBill 05-15-2010, 10:51 PM I got the report to work. What part of the report is not correct ?
PNGBill 05-15-2010, 10:56 PM I realise - i think. The report is 14 pages and should only be 1 or 2 pages. You need to a query that looks up data on the RimittanceID primary key where as your report is using RemittanceBenID as the table link and therefore selects all remittances for that beneficiary rather then a report on just that Remittance.
I will do a query for you.
braimi 05-15-2010, 11:03 PM Report is working but it is not working with the current remittance details. Try to make a new remittance record and then try to get the print report and see if it shows you only the current record which you just entered. It should not show all the records starting from the 1st remittance till the last.
PNGBill 05-15-2010, 11:09 PM I have changed your report query so it includes the RimittanceID which it must do if you want to match the report to the form.
next job is to get it to link to it only reports on the one remittanceID - will get this working and send to you soon.
braimi 05-15-2010, 11:14 PM Ok I am really thankful for your help and waiting to hear from you.
Thanks
PNGBill 05-15-2010, 11:42 PM RemittanceDetails Form works
PNGBill 05-15-2010, 11:52 PM First thing I did was copy your query in the report properties Data, Record Source to a new query and pasted.
I then added the field RemittanceID: [RemittanceUniqueID]
as the first field in the qry.
And I set the Criteria for this field to : [Forms]![RemittanceDetails]![RemitterUniqueID]
This links the field in your Form to the new field in your report.
To select the data for just one Remittance you MUST have the unique remittance ID in the query/report before any other steps can be taken.
I then set the reports datasource to the query. Really makes no difference if you have a separate query or a query actually in the report but for me I find it easier to edit and check when I deal with a query by it self.
Here is the sql query
SELECT RemittanceDetails.RemitterUniqueId AS RemittanceID, SenderDetails.SenderId, SenderDetails.SenderName, SenderDetails.SenderAddress1, SenderDetails.SenderPostalCode, SenderDetails.SenderCity, SenderDetails.SenderCountry, SenderDetails.SenderPhoneNo, BeneficiaryDetails.BeneficiaryId, BeneficiaryDetails.BeneficiaryName, BeneficiaryDetails.BeneficiaryCNICNo, BeneficiaryDetails.BeneficiaryAddress1, BeneficiaryDetails.BeneficiaryPostalCode, BeneficiaryDetails.BeneficiaryCity, BeneficiaryDetails.BeneficiaryCountry, BeneficiaryDetails.BeneficiaryPhoneNo, RemittanceDetails.RemitterKey, RemittanceDetails.RemitterUniqueId, RemittanceDetails.RemittanceDate, RemittanceDetails.RemittanceTime, RemittanceDetails.RemittanceCurrencyCode, RemittanceDetails.RemittanceAmount, RemittanceDetails.ExchangeRate, RemittanceDetails.LocalCurrencyCode, RemittanceDetails.LocalAmount, RemittanceDetails.RemittanceCharges
FROM (SenderDetails INNER JOIN BeneficiaryDetails ON SenderDetails.SenderId = BeneficiaryDetails.BenfSenderId) INNER JOIN RemittanceDetails ON BeneficiaryDetails.BeneficiaryId = RemittanceDetails.RemitterBenfId
WHERE (((RemittanceDetails.RemitterUniqueId)=[Forms]![RemittanceDetails]![RemitterUniqueID]));
Trust this assists
braimi 05-16-2010, 12:04 AM Thanks for the great work but I just downloaded the attached access file and tried to run it, now it is showing only one record in the print report preview but I feel you didn't check that the record it shows everytime is the first remittance record. try to change the remittance instead of 1st record to 5th or 6th record and then press preview report button, you will find that report is still showing the 1st record only.
PNGBill 05-16-2010, 12:14 AM I am on RemittanceDetails form and as I scroll through the form I see different Reference numbers .
200005, 200007, 200008, 200009, 200014, 200015 and 200016.
Which ever record I am on, if I click my Preview Report button I see a two page report only dealing with the remittance record that shows on the form at the time.
Haven't checked the other forms.
Advise which form is not working.
PNGBill 05-16-2010, 12:16 AM Here is the event procedure for the on click event for the report button:
Private Sub Command35_Click()
On Error GoTo Err_Command35_Click
Dim stDocName As String
stDocName = "RptRimittanceTest"
DoCmd.OpenReport stDocName, acPreview
Exit_Command35_Click:
Exit Sub
Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click
End Sub
You will see it refers to my RptRimittanceTest
You will need to edit this as you make your changes.
braimi 05-16-2010, 12:31 AM Yes I checked it. It is working fine on RemittanceDetails form but try to click the same button from the main form and you will find that it asks for the remittanceid and doesnt work. Also just to be sure that when you click the preview report button, does it take long to preview the report or it is just happening with me?
PNGBill 05-16-2010, 12:38 AM My Preview report button works instantly.
The other two forms are using your button that goes to your old report and query.
Have you tried to create a new button to my report and query but first rename them to what you prefer.
I will try and fix the other two forms up but.... you should make note of what is happening and edit this to suit your naming system etc.
PNGBill 05-16-2010, 01:04 AM RemittanceDetails works but although you have used this form as your subform in the two other forms it is no longer your form name in those forms.
The query is looking for the form RemittanceDetails.
We need more advanced skill to resolve this I have.
I will keep on it for a while but time is short.
braimi 05-16-2010, 01:05 AM Thanks a lot PNG... I solved other forms issue... I need to create separate query and report for each form and in each query I have to set criteria for RemittanceID for QrySender for SenderDetails form = forms!SenderDetails!BeneficiaryDetails!RemittanceD etails![RemitterUniqueId]
Thanks for your great help.... it is working now superb.... the delay was because the file you attached was in access 2000 format I just converted it back to 2007 format and now there is now delay in report preview....
PNGBill 05-16-2010, 01:16 AM Good news.
|