PRINT CURRENT RECORD from Form (1 Viewer)

R

Rich

Guest
Post a 97ver of your db here
 

jenny23

Registered User.
Local time
Today, 06:01
Joined
Apr 1, 2004
Messages
47
I don't have an Access 97.
I am sorry.
But that db is just a table with 2 fields and a form.
Can you make it up?
Thanks.
 
R

Rich

Guest
You have the option to save a copy as a previous version
 

___

¯¯¯¯¯
Local time
Today, 14:01
Joined
Nov 27, 2003
Messages
595
Is this what you want to do?
 

Attachments

  • testingPrintDB.zip
    19.9 KB · Views: 857

jenny23

Registered User.
Local time
Today, 06:01
Joined
Apr 1, 2004
Messages
47
IT WAS PERFECT. THANKS A LOT.

NOW, I tried to send this current record to Outlook by a Word doc attachment, but my code doesn't work. Can you please help me this time?

Private Sub Command93_Click()
On Error GoTo Err_Command93_Click

Dim stDocName As String

stDocName = "rptA"

DoCmd.SendObject acReport, stDocName, acFormatSNP, stDocName, , , "Subject Line", , False

Exit_Command93_Click:
Exit Sub
Err_Command93_Click:
MsgBox Err.Description
Resume Exit_Command93_Click
End Sub
 

___

¯¯¯¯¯
Local time
Today, 14:01
Joined
Nov 27, 2003
Messages
595
Code:
Private Sub Command93_Click()
On Error GoTo Err_Command93_Click

    Dim stDocName As String

    stDocName = "rptA"
    DoCmd.OpenReport stDocName, acViewPreview, , "[EmpID] = " & Me.EmpID & ""
    DoCmd.SendObject acSendReport stDocName, "RichTextFormat(*.rtf)", "Someone@Somewhere.com", "Cc", "Bcc", "Subject", "Message", True

Exit_Command93_Click:
Exit Sub

Err_Command93_Click:
Err.Clear
Resume Exit_Command93_Click
End Sub
 
Last edited:

jenny23

Registered User.
Local time
Today, 06:01
Joined
Apr 1, 2004
Messages
47
Can you modify the code so that when click on it, it open an outlook , then you can enter any email address you want to send?

Thanks.
 

___

¯¯¯¯¯
Local time
Today, 14:01
Joined
Nov 27, 2003
Messages
595
Code:
DoCmd.SendObject acSendReport, stDocName, "RichTextFormat(*.rtf)", , , , "Subject", "Message", True
 

jenny23

Registered User.
Local time
Today, 06:01
Joined
Apr 1, 2004
Messages
47
Woh Woh Woh....
It Worked Perfectly.
___ Is This Your Name?
Thanks.
Jenny.
 

devildog1966

New member
Local time
Today, 06:01
Joined
Feb 11, 2014
Messages
1
I adjusted the margins so that the form would fit to one page then just select to print the first page only. Worked for me. Mission accomplished.
 

Wiz47

Learning by inches ...
Local time
Today, 09:01
Joined
Nov 30, 2006
Messages
274
Code:
Private Sub Command93_Click()
On Error GoTo Err_Command93_Click

    Dim stDocName As String

    stDocName = "rptA"
    DoCmd.OpenReport stDocName, acViewPreview, , "[EmpID] = " & Me.EmpID & ""
    DoCmd.SendObject acSendReport stDocName, "RichTextFormat(*.rtf)", "Someone@Somewhere.com", "Cc", "Bcc", "Subject", "Message", True

Exit_Command93_Click:
Exit Sub

Err_Command93_Click:
Err.Clear
Resume Exit_Command93_Click
End Sub



Code:
Private Sub CmdPrintCurrent_Click()
On Error GoTo Err_Link

StrCriterion = "[ID]=" & Me![ID]

If Me.Dirty Then
 Me.Dirty = False
  End If

DoCmd.OpenReport "YourReportName", acPreview, , StrCriterion

Exit_Link:
  Exit Sub

Err_Link:
    If Err = 3075 Then
     MsgBox "No Record Found, Please Add a New Record.", , "Oops!"
      Resume Exit_Link
     Else
         MsgBox Err.Description
            Resume Exit_Link
End If

End Sub

I use a similar method to yours. With a bit of error handling. I also save the record before printing the report to make sure the current record is up to date.
 

Users who are viewing this thread

Top Bottom