S
stan
This code is attached to a button to retrieve documents stored in one
location-then moved to another. I'm a little puzzled by a message I get when
I hit the "cancel" button on the form (the rest of it seems t work OK). I
get:
"Microsoft Office Access can't find the field "|" referred to in your
expression (2465)"
This is the code:
Private Sub Command16_Click()
On Error GoTo err_cmdFetchAndStore_Click
Dim strStartSearch As String
Dim strOutgoingDirectory As String
Dim strFilter As String
strOutgoingDirectory = DLookup("FilePath", "Common", "[ID]=1")
strStartSearch = "C:\program files"
strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.PDF)", "* .PDF")
Dim strInputFileName As String
Dim strSQL As String
Dim strFileName As String
DoCmd.RunCommand acCmdSaveRecord
strInputFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
DialogTitle:="Please select an input file...", _
InitialDir:=strStartSearch, _
Flags:=ahtOFN_HIDEREADONLY)
strFileName = Me.[exp].Value & "-" & "[exp].pdf"
FileCopy strInputFileName, strOutgoingDirectory & "\" & strFileName
strSQL = "Update Requisition Set [exp] = '" & strOutgoingDirectory &
"\" & strFileName & "' where Requisition = " & Me.[exp]
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
exit_cmdFetchAndStore_Click:
DoCmd.SetWarnings True
Exit Sub
err_cmdFetchAndStore_Click:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume exit_cmdFetchAndStore_Click
End Sub
location-then moved to another. I'm a little puzzled by a message I get when
I hit the "cancel" button on the form (the rest of it seems t work OK). I
get:
"Microsoft Office Access can't find the field "|" referred to in your
expression (2465)"
This is the code:
Private Sub Command16_Click()
On Error GoTo err_cmdFetchAndStore_Click
Dim strStartSearch As String
Dim strOutgoingDirectory As String
Dim strFilter As String
strOutgoingDirectory = DLookup("FilePath", "Common", "[ID]=1")
strStartSearch = "C:\program files"
strFilter = ahtAddFilterItem(strFilter, "PDF Files (*.PDF)", "* .PDF")
Dim strInputFileName As String
Dim strSQL As String
Dim strFileName As String
DoCmd.RunCommand acCmdSaveRecord
strInputFileName = ahtCommonFileOpenSave( _
OpenFile:=True, _
DialogTitle:="Please select an input file...", _
InitialDir:=strStartSearch, _
Flags:=ahtOFN_HIDEREADONLY)
strFileName = Me.[exp].Value & "-" & "[exp].pdf"
FileCopy strInputFileName, strOutgoingDirectory & "\" & strFileName
strSQL = "Update Requisition Set [exp] = '" & strOutgoingDirectory &
"\" & strFileName & "' where Requisition = " & Me.[exp]
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
exit_cmdFetchAndStore_Click:
DoCmd.SetWarnings True
Exit Sub
err_cmdFetchAndStore_Click:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume exit_cmdFetchAndStore_Click
End Sub