Please Help with the Open/Save

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
 
D

Douglas J. Steele

What do you mean by "The file cannot be saved"? Your code snippet doesn't do
anything other than retrieve the desired file name. What code are you
running to try and save the file? What happens when you run it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top