[AccessD] Print letter from InputBox data (contains long code at bottom)

Bob Gajewski bob at renaissancesiding.com
Thu Jun 19 12:13:22 CDT 2003


Doris

In the Detail_Format section.

Regards,
Bob


On Thursday, June 19, 2003 12:50 PM, Mike and Doris Manning [SMTP:mikedorism at ntelos.net] wrote:
> I understand that but where are you using it?  Before you open the report?
> When you open the report (Report Open event)?  In a particular section of
> the report?
> 
> Doris Manning
> Database Administrator
> Hargrove Inc 
> www.hargroveinc.com
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Gajewski
> Sent: Thursday, June 19, 2003 12:19 PM
> To: 'accessd at databaseadvisors.com'
> Subject: RE: [AccessD] Print letter from InputBox data (contains long code
> atbottom)
> 
> 
> Doris
> 
> I am using the InputBox function 
> 
> Regards,
> Bob
> 
> On Thursday, June 19, 2003 12:03 PM, Mike and Doris Manning
> [SMTP:mikedorism at ntelos.net] wrote:
> > What event are you using to collect the information?
> > 
> > Doris Manning
> > Database Administrator
> > Hargrove Inc
> > www.hargroveinc.com
> > 
> > 
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob 
> > Gajewski
> > Sent: Thursday, June 19, 2003 11:55 AM
> > To: 'accessd at databaseadvisors.com'
> > Subject: [AccessD] Print letter from InputBox data (contains long code at
> > bottom)
> > 
> > 
> > Dear Group
> > 
> > I have a generic letter report that uses InputBoxes to allow custom
> > on-the-fly paragraph data entry 
> > 
> > The sequence asks the user for paragraph 1. If anything was input, it 
> > asks
> > for paragraph 2, then 3, then 4. Finally, it asks for the signator's name 
> > and title. The report os then displayed in preview mode. ALL OF THIS WORKS
> 
> > PERFECTLY. I can see the entire letter with all data, as entered. Also, 
> > when the preview is closed, the user is asked whether the letter printed 
> > properly, and if they respond yes, it automatically writes a record to the
> 
> > comments child table to record the event. THIS ALSO WORKS PERFECTLY 
> > 
> > My problem is when I try to actually print the letter (using File, 
> > Print or
> > clicking on the Print button), the program somehow starts over and prompts
> 
> > the user for paragraph one again (et cetera). I sure don't want users 
> > having to type their letters twice!
> > 
> > I'm missing something probably very obvious, and any guidance would be
> > greatly appreciated!
> > 
> > Thanks,
> > Bob Gajewski
> > 
> > **********************************************
> > Option Compare Database
> > Option Explicit
> > Public gvarRecordFound As Boolean
> > Public strInput1 As String
> > Public strInput2 As String
> > Public strInput3 As String
> > Public strInput4 As String
> > Public strInputS As String
> > Public strInputT As String
> > ------------------------------------------------------
> > Private Sub Report_NoData(Cancel As Integer)
> > Dim Msg, Response
> > Msg = "This report is not available; no records exist." Response = 
> > MsgBox(Msg, vbInformation) DoCmd.CancelEvent End Sub
> > ------------------------------------------------------
> > Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> > 
> > gvarRecordFound = True
> > 
> > Dim MyPos
> >     MyPos = InStr(1, [txtJobHomeownerName], ",")
> > 
> > If MyPos > 0 Then
> >     Me.txtLetterName = Mid([txtJobHomeownerName], MyPos + 1, 35) & " " 
> > &
> > Left([txtJobHomeownerName], MyPos - 1)
> >     Me.txtSalutation = "Dear " & Mid([txtJobHomeownerName], MyPos + 1, 35)
> 
> > & " " & Left([txtJobHomeownerName], MyPos - 1) & ":"
> > Else
> >     Me.txtLetterName = [txtJobHomeownerName]
> >     Me.txtSalutation = "Dear " & [txtJobHomeownerName] & ":" End If
> > 
> > If Left([txtLetterName], 1) = " " Then
> >     [txtLetterName] = Mid([txtLetterName], 2, 35)
> > End If
> > 
> > If Left([txtSalutation], 1) = " " Then
> >     [txtSalutation] = Mid([txtSalutation], 2, 41)
> > End If
> > 
> >     Me.txtLetterAddress = [txtJobAddress]
> >     Me.txtLetterLocation = [txtJobMunicipalityName] & ", " &
> > [txtJobStateCode] & " " & [txtJobZipCode]
> >     Me.txtClaimNumber = "'" & [txtJobCompanyReference] & "'"
> > 
> > 'Allow user to enter text for paragraphs 1-4
> >     Dim strMsg1 As String
> >         strMsg1 = "Please enter the text for paragraph 1:"
> >         strInput1 = InputBox(Prompt:=strMsg1, Title:="Paragraph 1")
> >         If Not (IsNull(strInput1) Or strInput1 = "") Then
> >             Me.txtParagraph1 = strInput1
> >             Dim strMsg2 As String
> >                 strMsg2 = "Please enter the text for paragraph 2:"
> >                 strInput2 = InputBox(Prompt:=strMsg2, Title:="Paragraph
> 2")
> >                 If Not (IsNull(strInput2) Or strInput2 = "") Then
> >                     Me.txtParagraph2 = strInput2
> >                     Dim strMsg3 As String
> >                         strMsg3 = "Please enter the text for paragraph 3:"
> >                         strInput3 = InputBox(Prompt:=strMsg3,
> > Title:="Paragraph 3")
> >                         If Not (IsNull(strInput3) Or strInput3 = "") Then
> >                             Me.txtParagraph3 = strInput3
> >                             Dim strMsg4 As String
> >                                 strMsg4 = "Please enter the text for 
> > paragraph 4:"
> >                                 strInput4 = InputBox(Prompt:=strMsg4, 
> > Title:="Paragraph 4")
> >                                 If Not (IsNull(strInput4) Or strInput4 = 
> > "") Then
> >                                     Me.txtParagraph4 = strInput4
> >                                 End If
> >                         End If
> >                 End If
> > 
> >             'Allow user to enter text for signator and title
> >                 Dim strMsgS As String
> >                     strMsgS = "Please enter the signator's name:"
> >                     strInputS = InputBox(Prompt:=strMsgS,
> > Title:="Signator")
> >                     If Not (IsNull(strInputS) Or strInputS = "") Then
> >                         Me.txtSignator = strInputS
> >                         Dim strMsgT As String
> >                             strMsgT = "Please enter the signator's title:"
> >                             strInputT = InputBox(Prompt:=strMsgT, 
> > Title:="Title")
> >                             If Not (IsNull(strInputT) Or strInputT = "") 
> > Then
> >                                 Me.txtSignatorTitle = strInputT
> >                             End If
> >                     Else
> >                         Me.txtSignator = "Renaissance Siding"
> >                     End If
> >         Else
> >             MsgBox "There was no text entered for Paragraph 1."
> >             Cancel = True
> >             gvarRecordFound = False
> >         End If
> > 
> > End Sub
> > ------------------------------------------------------
> > Private Sub Report_Close()
> > If gvarRecordFound = False Then
> >     Exit Sub
> > End If
> > Dim db As Database, rs As Recordset
> > Dim Response
> > Dim strMsgPrint As String
> >     strMsgPrint = "Did the letter print properly?"
> > If vbNo = MsgBox(strMsgPrint, vbYesNo + vbQuestion, "Print Letter
> > Verification") Then
> >     Response = acDataErrDisplay
> > Else
> >     'Add letter subject to comments
> >     Dim strInput As String, strMsg As String
> >         strMsg = "What was the subject of this letter?"
> >         strInput = InputBox(Prompt:=strMsg, Title:="Subject")
> >         If IsNull(strInput) Or strInput = "" Then
> >             strInput = "NOT SPECIFIED"
> >         End If
> >     Set db = CurrentDb
> >     Set rs = db.OpenRecordset("tblJobComments", dbOpenDynaset)
> >     On Error Resume Next
> >     rs.AddNew
> >         Dim strComment As String
> >             strComment = "HOMEOWNER LETTER PRINTED (SUBJECT: " & 
> > UCase(strInput) & ")."
> >         rs!lngJobID = lngJobID
> >         rs!txtJobComment = strComment
> >         rs!dteJobCommentNow = Now()
> >         rs!cboJobCommentPrivate = False
> >     rs.Update
> >     If Err Then
> >         MsgBox "An error occurred, and the comments were not updated." & 
> > vbCrLf & "Remember to add a comment to the database" & vbCrLf & "record 
> > indicating that the letter was sent today."
> >         Response = acDataErrContinue
> >     Else
> >         Response = acDataErrAdded
> >     End If
> >     rs.Close
> > End If
> > End Sub
> > 
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> > _______________________________________________
> > AccessD mailing list
> > AccessD at databaseadvisors.com 
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> > 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 



More information about the AccessD mailing list