Extra_Cover
Registered User.
- Local time
- Today, 12:09
- Joined
- Oct 21, 2008
- Messages
- 71
Bit of long shot.
I have written a routine that allows the user to change a customer trading status in another piece of software though a 'gateway' utility the software company provides ( see screenshot attached ).
This worked fine until I added some code that e-mails any sales orders outstanding for the particular customer (it's remarked out in the code). Now the e-mail is sent the first time you press the button but on the second time I get Error -75 Path/File Error. If I remove the e-mail section of the code the app works fine though?
Code below - it bombs on Open tmpfile for Output As #1
I have written a routine that allows the user to change a customer trading status in another piece of software though a 'gateway' utility the software company provides ( see screenshot attached ).
This worked fine until I added some code that e-mails any sales orders outstanding for the particular customer (it's remarked out in the code). Now the e-mail is sent the first time you press the button but on the second time I get Error -75 Path/File Error. If I remove the e-mail section of the code the app works fine though?
Code below - it bombs on Open tmpfile for Output As #1
Code:
Private Sub Command8_Click()
Dim cdmsg As String
Dim printline As String
Dim tmpfile As String
Dim uniplanfile As String
Dim usuff As String
Dim cdmailmsg As String
Dim cdmailsubj As String
Dim rs As Recordset
cdmsg = MsgBox("Post Change?", vbYesNo, "TFC Group LLP")
If cdmsg = vbYes Then
'
' Change Local Recordset
'
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Tbl_SLEG_Header")
With rs
rs.MoveFirst
Do Until Me.FrmCode = rs.Fields("sleg_cust")
rs.MoveNext
Loop
rs.Edit
rs.Fields("TblDescription") = Me.FrmNew.Column(1)
rs.Update
End With
rs.Close
Set rs = Nothing
printline = Me.FrmCode & "," & Me.FrmNew
tmpfile = "HoldingFile" & "." & Format(Now(), "NN") & Format(Now(), "SS")
Open tmpfile For Output As #1
Print #1, printline
Close #1
'
'Copy File To UNIPLAN system Gateway
'-----------------------------------
'
usuff = "." & Format(Now(), "NN") & Format(Now(), "SS")
uniplanfile = "\\TFCRDS\home\gateway\import\ILSA1STAT" & usuff
FileCopy tmpfile, uniplanfile
' delete file
Kill tmpfile
cdmsg = MsgBox("Change Posted.", vbInformation, "TFC Group LLP")
'
' Now Find Sales Orders
'
If Me.FrmCurrent > 0 Then
'
' Send E-Mail
'
'cdmailmsg = "Status has changed from " & Me.FrmCurrent & " To " & Me.FrmNew.Column(1) & "." & "Please find affected orders attached."
'cdmailsubj = "Credit Status has changes for " & Me.FrmCode & "-" & Me.Text0
'DoCmd.Close
'DoCmd.SendObject acSendReport, "Rpt_SLEG_SalesOrders", "PDF", "xxx@gmail.com", , , cdmailsubj, cdmailmsg
DoCmd.RunMacro "Mcr_SLEG_SOReport"
MsgBox ("Mail Sent")
End If
DoCmd.Close
Else
cdmsg = MsgBox("Action Cancelled.", vbExclamation, "TFC Group LLP")
Me.FrmNew.SetFocus
End If
End Sub
Attachments
Last edited: