[AccessD] Adding Attachments

Hollis,Virginia HollisVJ at pgdp.usec.com
Thu Mar 13 10:18:35 CST 2003


I found the below code (Save_DriveJ) on Microsoft. It will open the Save
dialog, Except it does not actually save the same file. When I click on the
name of the file that is placed in the field 'attachments' it is not the
same file, it has the correct title, but it overwrites the text in the file
to show only the words, Attached Document.
 
Virginia
 
This is what I put on the command button on the form:
***********
 Dim strFile As String
 
  strFile = GetOpenFile("J:\RCSEAtt\", "Select a File To Attach")
  
    Call Save_DriveJ
    
    If CmnDlg.FileName > " " Then
   Attachments = "Attached Document" & "#" & CmnDlg.FileName & "#"
End If
 
***************
Function Save_DriveJ()
    Dim X As Integer
 
    Do
        CmnDlg.Action = 2    'save file
        If UCase(Left(CmnDlg.FileName, 1)) <> "J" Then
            MsgBox "You must save file to drive J only"
        Else
            Exit Do
        End If
        DoEvents
    Loop
 
    X = FreeFile
    Open CmnDlg.FileName For Output As #X
        Attachments.SetFocus
        Print #X, Attachments.Text
    Close #X
    MsgBox "File has been saved to drive J"


-----Original Message-----
From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com]
Sent: Thursday, March 13, 2003 9:29 AM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Adding Attachments


I have been playing around with the dialog to Save the file to a specified
folder. Tell me if anyone thinks this will work...
 
Use the Open file dialog so the user can select the file they need to
attach. Then the Save dialog box opens to the directory & folder where the
attachment needs to be saved.
 
Once they save the file it places the file name in the field 'attachments'
which is a hyperlink field.
 
Now, the problem... (there's always a catch)
 
How do I make the Save dialog box actually "Save" the file?! 
 
The Save dialog opens, and places the file name in the attachments field,
but it does not Save the file to the folder & directory.
 
Virginia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030313/37121c6b/attachment-0001.html>


More information about the AccessD mailing list