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 "You chose a different extension!"
End If
ExitHere:
Set cdl = Nothing
Exit Sub
HandleErrors:
Select Case Err.Number
Case cdlCancel
' Cancelled!
Resume ExitHere
Case Else
MsgBox "Error: " & Err.Description & _
"(" & Err.Number & "
"
End Select
Resume ExitHere
End Sub
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 "You chose a different extension!"
End If
ExitHere:
Set cdl = Nothing
Exit Sub
HandleErrors:
Select Case Err.Number
Case cdlCancel
' Cancelled!
Resume ExitHere
Case Else
MsgBox "Error: " & Err.Description & _
"(" & Err.Number & "
End Select
Resume ExitHere
End Sub