Bizarre Path/File Error - 75 (1 Viewer)

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

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

  • Screenshot.jpg
    Screenshot.jpg
    104 KB · Views: 83
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:09
Joined
May 7, 2009
Messages
19,246
a wild guess, you have
not define the path of tmpfile.
it is usually saved on MyDocuments,
but still you have to explicitly
say this:

' save to MyDocuments
tmpfile = Environ("UserProfile") & "\Documents"
tmpfile = tmpfile & HoldingFile." & Format(Now(), "nnss")
 

Extra_Cover

Registered User.
Local time
Today, 12:09
Joined
Oct 21, 2008
Messages
71
a wild guess, you have
not define the path of tmpfile.
it is usually saved on MyDocuments,
but still you have to explicitly
say this:

' save to MyDocuments
tmpfile = Environ("UserProfile") & "\Documents"
tmpfile = tmpfile & HoldingFile." & Format(Now(), "nnss")

Thanks that did the trick. Odd though I have other similar routines that work fine without defining a path, guess I was just being lazy. I shall use this method from now on.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:09
Joined
May 7, 2009
Messages
19,246
sorry should be

tmpfile = Environ("UserProfile") & "\Documents\"
tmpfile = tmpfile & HoldingFile." & Format(Now(), "nnss")
 

Users who are viewing this thread

Top Bottom