Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfering Docs. from Users C drive to common shared file

Status
Not open for further replies.

BubbaJean

IS-IT--Management
Jun 5, 2002
111
US
I'm using Access 2000, Currently I have a CommonDlg allowing the user to search for PDF. files on his/her C drive, and they copy/paste the URL into a text field on a form, below is the code for this function: this works great, however, now they want the database to copy the pdf drawing from the users C drive and place the file into a common shared file (we'll call it B\DOCS\nameofdrawing.pdf)
and keep the new URL name.
example would be
From:
C\DOCS\drawing1.pdf
C\DOCS\drawing2.pdf

TO
B\DOCS\drawing1.pdf
B\DOCS\drawing2.pdf

hope someone can help!!

Private Sub cmdFileOpen_Click()

' Test the CommonDlg class' FileOpen common dialog.

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd
cdl.CancelError = True

On Error GoTo HandleErrors

' Set three pairs of values for the Filter.
cdl.Filter = _
"Adobe Acrobat Document (*.pdf)|" & _
"*.pdf|" & _
"Database files (*.mdb, *.mde, *.mda)|" & _
"*.mdb;*.mde;*.mda|" & _
"All files (*.*)|" & _
"*.*"

' Select filter 1 (DataShete files) when
' the dialog opens.
cdl.FilterIndex = 1

' Indicate that you want to use a callback function,
' change back to the original directory when
' you're done, and require that the selected
' file actually exist.
cdl.OpenFlags = cdlOFNEnableHook Or _
cdlOFNNoChangeDir Or cdlOFNFileMustExist

' Select the callback function.
cdl.CallBack = adhFnPtrToLong(AddressOf GFNCallback)

' Set up miscellaneous properties.
cdl.InitDir = "C:\"
cdl.FileName = "autoexec.pdf"
cdl.DefaultExt = "pdf"

' Open the file open dialog box,
' and wait for it to be dismissed.
cdl.ShowOpen

' Retrieve the selected file na
txtFileOpen = cdl.FileName

' Check the OpenFlags (or Flags) property to
' see if the selected extension is different than
' the default extension.
If (cdl.OpenFlags And _
cdlOFNExtensionDifferent) <> 0 Then
MsgBox &quot;You chose a different extension!&quot;
End If

ExitHere:
Set cdl = Nothing
Exit Sub

HandleErrors:
Select Case Err.Number
Case cdlCancel
' Cancelled!
Resume ExitHere
Case Else
MsgBox &quot;Error: &quot; & Err.Description & _
&quot;(&quot; & Err.Number & &quot;)&quot;
End Select
Resume ExitHere
End Sub
 
Have you looked into the capabilities of the FileSystemObject?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I would search the forum. There are lots of example using those objects.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top