reports with date and without but just for one record!

lynsey2

Registered User.
Local time
Today, 11:21
Joined
Jun 18, 2002
Messages
439
Hi guys

me again:rolleyes:

my methadone script needs to work by 2mo and i cant seem to get it working dispite all me posts on it!

i need it to print out ONLY the currant record.

i need it to print the script twice.

one copy with a date on it and the other copy without a date.

i need it to print a calculated field. (which is not working and i dont know why...i have tried using the field in the table that it is tored then i tried just an unbound text box on the report with the calculation in it but that doesnt work either)

:( :confused: :eek: :eek: :( :( :confused:

please any help would be great! even if its just a wee thing, this really needs to work 2mo or i think im gonna get sacked..it was supposed to be done weeks ago!
 
really freeking out now guy's, nothing i do seems to work, i have my ART one working great but this methadone one sucks! i saw this in someone elses post and tried it but had to take it out cos it didnt work for me!

Private sub Print()
on error GoTo ErrTrap
Dim Currform as Form
set Currform = screen.ActiveForm
DoCmd.RumCommand acSaveRecord
DoCmd.OpenReport "MethPrescriptionPrint", ac ViewNormal,"", "[Ref:] = [Forms]![Currform.name &"]![Ref:]"

Code_Exit
Exit Sub

ErrTrap:
MsgBox Error$
Resume Code_Exit
End Sub
 
strDocName = "MethPrescriptionPrint"
strFilter = "Ref: = Forms!Methadone_Script!Ref:"

DoCmd.OpenReport strDocName, acViewNormal, , strFilter

this doesnt work and i dont know why!
 
Private sub print()
on error GoTo ErrTrap

Dim currform as form
Set currform = Screen.ActiveForm
DoCmd.RunCmd acSaveRecord
DoCmd.OpenReport "MethprescriptionPrint", acViewNormal,"","[Ref:]=[Forms]!["_& currform.Name & "]![Ref:]"

Code_Exit:
Exit Sub

ErrTrap:
MsgBox Error$
Resume Code_Exit
End Sub

that doesnt work either
 
read something somewhere about the scope option and setting it to RECORD but cant find it
 
Create a command button that prints the current record
Open the form in Design view.


Click Control Wizards in the toolbox if it's not already pressed in.


In the toolbox, click Command Button .


On the form, click where you want to place the command button.


In the first wizard dialog box, click Record Operations in the Categories box, and then click Print Record in the Actions box.


Follow the directions in the wizard dialog boxes. In the last dialog box, click Finish to display the command button in Design view.
If you want to see the event procedure that makes the button work, open the button's property sheet, and then click the Build button next to the OnClick property box.

Tip You can print a form's current record in a report by carrying out the OpenReport action in the Click event procedure for a command button. For example, adding the following Visual Basic for Applications code to the Click event procedure for a command button on an Orders form prints the current record in the Invoice report:

Dim strDocName As String
Dim strFilter As String
strDocName = "Invoice"
strFilter = "OrderID = Forms!Orders!OrderID"
DoCmd.OpenReport DocName, acViewNormal, , strFilter



i tried this and it doesnt work!!! im really stuck!this is the example access help gives
 
' set it up to print only the currant record!
Dim strDocName As String
Dim strFilter As String

strDocName = "MethPrescriptionPrint"
strFilter = "Ref: = Forms!Methadone_Script!Ref:"

DoCmd.OpenReport strDocName, acViewNormal, , strFilter

Exit_Command134_Click:
Exit Sub

Err_Command134_Click:
Msgbox Err.Description
Resume Exit_Command134_Click

End Sub


tried this and it doesnt work as i have an erreo in expression strFilter = "Ref: = Forms!Methadone_Script!Ref:" so something is wrong with that! i still cant work it out though! its all spelt correct!
 
oh well never mind...lets just wait and see whats said! off to a meeting now..might not b back!:rolleyes: hopefuly ill get an extention though, enough time to work this out!
 
ok right the meeting was bad but i didnt get sacked!YEY!
must have given me a kick up the bum though cos i seem to have fixed most of the problems.

TO ONLY GET THE CURRANT RECORD

I took the filter bit out of my print button code, i went into the report and change the control source of the report into a sql qry with this code:
SELECT [MethStore].[Ref:], [MethStore].[Patient Number], [MethStore].[Date], [MethStore].[Stop Date], [MethStore].[Days], [MethStore].[DaysTxT], [MethStore].[Doctor], [MethStore].[Consultant], [MethStore].[Surname], [MethStore].[Forename], [MethStore].[Address1], [MethStore].[Address2], [MethStore].[Address3], [MethStore].[Post Code], [MethStore].[Dob], [MethStore].[Total Amount], [MethStore].[Total Amount TxT], [MethStore].[Number of Doses], [MethStore].[Number of Doses TxT], [MethStore].[Supervised], [MethStore].[Monday], [MethStore].[Tuesday], [MethStore].[Wednesday], [MethStore].[Thursday], [MethStore].[Friday], [MethStore].[Saturday], [MethStore].[EveryDay], [MethStore].[EveryDayexcept], [MethStore].[Dispenced], [MethStore].[Clear], [MethStore].[SugarFree], [MethStore].[Date last Supervised], [MethStore].[Dose mg], [MethStore].[Comments], [MethStore].[DoseInmgtxt], [MethStore].[supervised text], [MethStore].[mondaytext], [MethStore].[tuetext], [MethStore].[wedtext], [MethStore].[thurstext], [MethStore].[fritext], [MethStore].[sattext], [MethStore].[everydaytext], [MethStore].[everydayexcepttext], [MethStore].[cleartxt], [MethStore].[sugarfreetext] FROM MethStore WHERE ((([MethStore].[Ref:])=[Forms]![Methadone Script]![Ref:]));

I GOT THE CALCULATED FIELD TOTAL AMOUNT TO WORK

by doing this code

="Methadone Mixture DTF 1(one)mg per 1(one)ml " & [cleartxt] & [sugarfreetext] & " " & (([Stop Date]-[Start Date])*[Dose mg]) & " " & [Total Amount TxT] & " mls to be taken in " & ([Stop Date]-[Start Date]) & " " & [Number of Doses TxT] & " daily doses of " & [Dose mg] & " " & [DoseInmgtxt] & " mls."

the bold bit used to be [Number of Doses]*[Dose mg] but as you can see i dont stor Number of Doses so i have to work it out by doing Stopdate - start date.

THANKS FOR HELPING ME WHEN I NEED IT.
 
ps if anyone fanceys helping me on how i get the report to print out twice once with a date once without i would be very greatful...i will keep checking and let you know if i get it too.

THANK YOU ALL!:D
 
Lyns

I told you yesterday you wouldn't get the sack.
You will get there

Col
:cool:
 
To get the second copy without the date, cheat and add the
DoCmd.OpenReport etc again with the extra line
Reports!MyReport!MyDateField.Visible=False
 

Users who are viewing this thread

Back
Top Bottom