Please can you help!!! :(

lynsey2

Registered User.
Local time
Today, 09:52
Joined
Jun 18, 2002
Messages
439
I have code that i thought worked but doesn't and it needs fixed.

Private Sub PrintScript_Click()
On Error GoTo Err_PrintScript_Click
' print ART report

DoCmd.RunCommand acCmdSaveRecord

' print the record with three different headings

Me.fld_ReportTitle = "Pharmacy Copy"
DoCmd.OpenReport "ART", acViewNormal

Me.fld_ReportTitle = "Case Notes Copy"
DoCmd.OpenReport "ART", acViewNormal

Me.fld_ReportTitle = "GP Copy"
DoCmd.OpenReport "ART", acViewNormal

With DoCmd
.SetWarnings False
.OpenQuery "ARTmaster2his1"
.OpenQuery "AppendDrug1"
.OpenQuery "AppendDrug2"
.OpenQuery "AppendDrug3"
.OpenQuery "AppendDrug4"
.OpenQuery "AppendDrug5"
.OpenQuery "AppendDrug6"
.OpenQuery "AppendDrug7"
.SetWarnings True
End With

Exit_PrintScript_Click:
Exit Sub

Err_PrintScript_Click:
msgbox Err.Description
Resume Exit_PrintScript_Click

End Sub

I have these append qry's so that when a script is made ALL the details are stored in ARTScriptmaster (a table)
his1(another table) holds the first few fields of ARTScriptmaster
his2(another table) holds the drugs that were prescribed on a script...

You can prescribe up to 7 drugs but if you only prescribe 2 then his2 only has those in it.

On pressing print the record is supposed to be saved in ARTScriptmaster the qry's run and the chosen fields put into his1 and his2

Please help.... I have left now but they can’t fix this

The qrys do work (manually) if you go into the qry section and run them and type the ref number.
 
How does it not work?

Is the report printing the incorrect data or are the append queries not appending?

Are the reports closed before the amend queries are opened?
 
sorry, telling you what was wrong might have been a good idea eh!! :rolleyes: sorry

the append qrys dont append the data (from behind this button anyway...they do work if you do it manually)

the reports are not closed before the qry's are opened no? might that be the problem?
 

Users who are viewing this thread

Back
Top Bottom