M
Mlavoy
I am running 2003 with a back end and three front ends. The sub listed below
worked on all three machines until yesterday. One of them now gives me a out
of stack error and I can't figure out why. HELP!!
Thanks.
On Error GoTo Err_Command175_Click
'create a letter
Dim objDocument As Object
Dim strFolderName
Dim fso, f, f1, fc
strpath = DLookup("pathname", "fileparameters", "counter = 2")
strFolderName = strpath & "\" & Me!AccountingID
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(strFolderName)) = False Then
'MsgBox "Y"
'Else
If MsgBox("Folder for this contact does not exist, do you want to create
one?", vbOKCancel, "File save error") = vbOK Then
fso.createfolder (strFolderName)
Else
Exit Sub
End If
End If
'Set f = Nothing
'Set fc = Nothing
Set fso = Nothing
Set objDocument = GetObject(strpath & "\PersonalLetter.dot")
DoCmd.OpenForm "qryMailtoContact", acNormal, , , , acHidden
DoCmd.OpenForm "subfrmDocuments", acNormal, , , acFormAdd, acHidden
intnewrec = DCount("clientid", "addresstbl", "clientid =
forms!qrymailtocontact!socialsecurityno")
If intnewrec = 0 Then
MsgBox "There is no reocrd"
DoCmd.Close acForm, "qryMailtoContact"
DoCmd.Close acForm, "subfrmDocuments"
Exit Sub
End If
strdocname = InputBox("What name to you want this document saved as?", "Save
document name") & ".doc"
If strdocname = ".doc" Then
strConfirm = MsgBox("There was no name entered, do you want to quit this
wizard?", vbYesNo, "Print error")
If strConfirm = 6 Then
Exit Sub
Else
strdocname = InputBox("What name to you want this document saved as?", "Save
document name") & ".doc"
End If
End If
objDocument.Application.Visible = True
Forms!subfrmDocuments!CLIENTID = Forms!qrymailtocontact!socialsecurityno
Forms!subfrmDocuments!DocType = 3
Forms!subfrmDocuments!DocName = strdocname
Forms!subfrmDocuments!DocLocation = strpath & "\" & Me!AccountingID & "\"
DoCmd.Close acForm, "subfrmDocuments"
With objDocument.bookmarks
.Item("contact_name").range.Text = Nz(Forms!qrymailtocontact!LASTNAME)
.Item("address1").range.Text = Nz(Forms!qrymailtocontact!!address1)
.Item("date").range.Text = Format(Date, "mmmm dd, yyyy")
.Item("city").range.Text = Nz(Forms!qrymailtocontact!!City)
.Item("state").range.Text = Nz(Forms!qrymailtocontact!!State)
.Item("zipcode").range.Text = Nz(Forms!qrymailtocontact!!Zipcode)
.Item("salutation").range.Text = Nz(Forms!qrymailtocontact!!Salutation)
End With
objDocument.saveas strpath & "\" & Me!AccountingID & "\" & strdocname
DoCmd.Close acForm, "qryMailtoContact"
DoCmd.Requery
Exit_Err_Command175_Click:
Exit Sub
Err_Command175_Click:
MsgBox Err.Number & "; " & Err.Description
Resume Exit_Err_Command175_Click
worked on all three machines until yesterday. One of them now gives me a out
of stack error and I can't figure out why. HELP!!
Thanks.
On Error GoTo Err_Command175_Click
'create a letter
Dim objDocument As Object
Dim strFolderName
Dim fso, f, f1, fc
strpath = DLookup("pathname", "fileparameters", "counter = 2")
strFolderName = strpath & "\" & Me!AccountingID
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(strFolderName)) = False Then
'MsgBox "Y"
'Else
If MsgBox("Folder for this contact does not exist, do you want to create
one?", vbOKCancel, "File save error") = vbOK Then
fso.createfolder (strFolderName)
Else
Exit Sub
End If
End If
'Set f = Nothing
'Set fc = Nothing
Set fso = Nothing
Set objDocument = GetObject(strpath & "\PersonalLetter.dot")
DoCmd.OpenForm "qryMailtoContact", acNormal, , , , acHidden
DoCmd.OpenForm "subfrmDocuments", acNormal, , , acFormAdd, acHidden
intnewrec = DCount("clientid", "addresstbl", "clientid =
forms!qrymailtocontact!socialsecurityno")
If intnewrec = 0 Then
MsgBox "There is no reocrd"
DoCmd.Close acForm, "qryMailtoContact"
DoCmd.Close acForm, "subfrmDocuments"
Exit Sub
End If
strdocname = InputBox("What name to you want this document saved as?", "Save
document name") & ".doc"
If strdocname = ".doc" Then
strConfirm = MsgBox("There was no name entered, do you want to quit this
wizard?", vbYesNo, "Print error")
If strConfirm = 6 Then
Exit Sub
Else
strdocname = InputBox("What name to you want this document saved as?", "Save
document name") & ".doc"
End If
End If
objDocument.Application.Visible = True
Forms!subfrmDocuments!CLIENTID = Forms!qrymailtocontact!socialsecurityno
Forms!subfrmDocuments!DocType = 3
Forms!subfrmDocuments!DocName = strdocname
Forms!subfrmDocuments!DocLocation = strpath & "\" & Me!AccountingID & "\"
DoCmd.Close acForm, "subfrmDocuments"
With objDocument.bookmarks
.Item("contact_name").range.Text = Nz(Forms!qrymailtocontact!LASTNAME)
.Item("address1").range.Text = Nz(Forms!qrymailtocontact!!address1)
.Item("date").range.Text = Format(Date, "mmmm dd, yyyy")
.Item("city").range.Text = Nz(Forms!qrymailtocontact!!City)
.Item("state").range.Text = Nz(Forms!qrymailtocontact!!State)
.Item("zipcode").range.Text = Nz(Forms!qrymailtocontact!!Zipcode)
.Item("salutation").range.Text = Nz(Forms!qrymailtocontact!!Salutation)
End With
objDocument.saveas strpath & "\" & Me!AccountingID & "\" & strdocname
DoCmd.Close acForm, "qryMailtoContact"
DoCmd.Requery
Exit_Err_Command175_Click:
Exit Sub
Err_Command175_Click:
MsgBox Err.Number & "; " & Err.Description
Resume Exit_Err_Command175_Click