zali Newbie
Joined: 27 Feb 2006 Posts: 3
|
Posted: Mar 5th, 2006 08:57 PM Post subject: change file path and opening image/excel/word files |
|
|
hi....I have decided not to store my files in the database as performance may be slower in the future when there are more files....so therefore Im gona save the path of the file instead in the database and save the path in a common network drive...can anyone tell me how do i change the path saved when the dialog box pops up and the user selects what files they want to choose to save? Now I only knw how to save the pathname as it was retrieved from the dialog.....how do I change the pathname to save in another network drive? Right now in order to change the pathname I have a save dialog which follows the first open dialog but thats not what I want as i want to save it all to a common drive..
here are codes i used to attach the file
Private Sub cmdAttachment_Click()
Dim mystring As String
Dim myst As String
On Error GoTo DialogError
With CommonDialog1
.CancelError = True
.Filter = "Text Files (*.txt)|*.txt"
.FilterIndex = 1
.DialogTitle = "Select a file to attach"
.ShowOpen
MsgBox "You have selected " & .FileName
'With CommonDialog1
.CancelError = True
.Filter = "Text Files (*.txt)|*.txt"
.FilterIndex = 1
.DialogTitle = "Select a place to store the file"
.ShowSave
mystring = Trim$(CommonDialog1.FileName)
MsgBox mystring
txtAttach.Text = mystring
m_recRMA!Attachment = mystring
m_recRMA.Update
End With
DialogError:
End Sub
And this is the code to open the file attached...
Dim sExtension As String
Dim iReturnValue As Variant
sExtension = UCase(Right$(txtAttach.Text, 3))
If Dir$(txtAttach.Text) = "" Then
MsgBox "Sorry cannot find file" & vbCrLf _
& "It may b hidden.", vbExclamation
Exit Sub
ElseIf sExtension = "TXT" Then
iReturnValue = Shell("notepad " & txtAttach.Text, 1)
End If
End Sub
If it were a image file or other files like doc/excell how do i open it? The above only works for text files...how do i attach the other file types???? helpppppppp _________________ The unfortunate, led by the unreliable, asked to to undesirable for the ungrateful |
|