M
magmike
I just want a button that inserts text into a field, before opening a
report.
Here's the details:
THE FORM, titled ItemsSent is for sending letters and capturing the
text of those letters into a table relating to the company the letter
was sent to. The two fields in question here are ItemsSent.Notes and
ItemsSent.LetterCopy. There is also a subform on the form that shows
anyother listings for this company in the past, and that subform has
the Notes field as well.
THE COMMAND BUTTON, is meant to be pushed, and when pushed, inserts
text into the ItemsSent.Notes field ("Blank Letterhead used with
LetterCopy") and then runs code to open the report which is a
formatted letter using the data from the record.
THE PROBLEM - even though my code instructs to insert text into the
Notes field, it inserts it into the LetterCopy field. Both fields are
memo fields. Also, I notice in the code, that it automatically changes
Notes into all capitals (NOTES).
THE CODE:
Private Sub PrintBlankLetter_Click()
Dim stDocName As String
Dim stLinkCriteria As String
NOTES.SetFocus
NOTES.Text = "Blank Letterhead used with LetterCopy"
DoCmd.Requery
DoCmd.Minimize
stLinkCriteria = "[ItemsSentID]=" & Me![ItemsSentID]
stDocName = "Blank Letter"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_PrintBlankLetter_Click:
Exit Sub
Err_PrintBlankLetter_Click:
MsgBox Err.Description
Resume Exit_PrintBlankLetter_Click
End Sub
Thanks in advance!
magmike
report.
Here's the details:
THE FORM, titled ItemsSent is for sending letters and capturing the
text of those letters into a table relating to the company the letter
was sent to. The two fields in question here are ItemsSent.Notes and
ItemsSent.LetterCopy. There is also a subform on the form that shows
anyother listings for this company in the past, and that subform has
the Notes field as well.
THE COMMAND BUTTON, is meant to be pushed, and when pushed, inserts
text into the ItemsSent.Notes field ("Blank Letterhead used with
LetterCopy") and then runs code to open the report which is a
formatted letter using the data from the record.
THE PROBLEM - even though my code instructs to insert text into the
Notes field, it inserts it into the LetterCopy field. Both fields are
memo fields. Also, I notice in the code, that it automatically changes
Notes into all capitals (NOTES).
THE CODE:
Private Sub PrintBlankLetter_Click()
Dim stDocName As String
Dim stLinkCriteria As String
NOTES.SetFocus
NOTES.Text = "Blank Letterhead used with LetterCopy"
DoCmd.Requery
DoCmd.Minimize
stLinkCriteria = "[ItemsSentID]=" & Me![ItemsSentID]
stDocName = "Blank Letter"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_PrintBlankLetter_Click:
Exit Sub
Err_PrintBlankLetter_Click:
MsgBox Err.Description
Resume Exit_PrintBlankLetter_Click
End Sub
Thanks in advance!
magmike