J
jrtmiller
I am trying to create a command button that has a text box next to it
for locating a file on an individuals hard drive and then saving it to
a shared file on a server. I am "very new" to Access and am having
difficulty getting it to work. I have taken Ken Getz's example and am
able to get the file to open but I cannot get the file to save in
another location.
I have placed his code (http://www.mvps.org/access/api/api0001.htm) in
a module and placed this code for the button:
***********************************
Private Sub Command48_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)",
"*.doc")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
If Len(Trim(strInputFileName)) = 0 Then
'user did not pick anything
Exit Sub
End If
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)", "*.doc")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End Sub
*******************************
When the button is selected, an Open Window actually opens, when the
file is selected, it advances to the Save Window, but when I enter a
new file name and locate the folder it is to be stored in, the file
cannot be saved.
Please, what am I doing wrong?
Kindest Regards
JMiller
for locating a file on an individuals hard drive and then saving it to
a shared file on a server. I am "very new" to Access and am having
difficulty getting it to work. I have taken Ken Getz's example and am
able to get the file to open but I cannot get the file to save in
another location.
I have placed his code (http://www.mvps.org/access/api/api0001.htm) in
a module and placed this code for the button:
***********************************
Private Sub Command48_Click()
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)",
"*.doc")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
If Len(Trim(strInputFileName)) = 0 Then
'user did not pick anything
Exit Sub
End If
strFilter = ahtAddFilterItem(strFilter, "Word Files (*.doc)", "*.doc")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)
End Sub
*******************************
When the button is selected, an Open Window actually opens, when the
file is selected, it advances to the Save Window, but when I enter a
new file name and locate the folder it is to be stored in, the file
cannot be saved.
Please, what am I doing wrong?
Kindest Regards
JMiller