Help rtf printing the same record!! (1 Viewer)

allj

Registered User.
Local time
Today, 07:18
Joined
Sep 4, 2008
Messages
39
Hi - Access 03
I use the a macro with runcode with the following code to bring up the print dialog box. If the form detail is gray it changes it to white and then back to gray after printing. fldnote is the controlsource for Lebans rtf and for the heck of it i put the same controlsource in a textbox. The textbox and records change but the info in the rtf does not.
Function dialog()
On Error Resume Next
Dim strfilter As String, MyForm As Form, color As String
Set MyForm = Screen.ActiveForm
strfilter = Replace(MyForm.Filter, MyForm.recordsource & ".", "")
If MyForm.Detail.BackColor <> "16777215" Then
color = MyForm.Detail.BackColor
MyForm.Detail.BackColor = "16777215"
End If
DoCmd.RunCommand acCmdPrint
MyForm.Detail.BackColor = color
End Function


I had the same problem when using docmd.print. If I had the following code in a module it printed the same record but if I had a macro that with runcode to change the detail to white using a function call then printout in the macro and then runcode for a function gray() again this worked????
I repaired access and reinstalled the rtf.ocx and took out the detail color change. Any help is much appreciated. Alan


Function OpenNoteRpt()
Dim stDocName As String, strfilter As String, MyForm As Form
Set MyForm = Screen.ActiveForm
strfilter = Replace(MyForm.Filter, MyForm.recordsource & ".", "")
Forms!frmnote1.Detail.BackColor = "16777215"
DoCmd.OpenForm MyForm.name, acPreview, strfilter
'stDocName = MyForm.name

DoCmd.SelectObject acForm, strDocName, True

DoCmd.RunCommand acCmdPrint
DoCmd.SelectObject acForm, MyForm.name, False
MyForm.Detail.BackColor = "13816530"

End Function
 

Users who are viewing this thread

Top Bottom