B
BJ Freeman
I use CommonDialog as a late binding object in a Access VBA.
Set fileopen = CreateObject("MSComDlg.CommonDialog") this is the
C:\WINDOWS\SYSTEM32\comdlg32.ocx
this works in my office 2000
when I send the Access to a client they get an error, in Access2002.
the expression you entered as a event property setting produced the
following error:
the action requires a filename aurgment.
here is the code:
routine 1
Dim filename
filename = getfile(CurrentProject.Path, "EPOSTAGE*.txt)|EPOSTAGE*.txt")
If InStr(filename, "no files found.") > 0 Then
MsgBox " unable to find Endicia export file EPOSTAGE*txt)"
Exit Sub
End If
routine 2
Function getfile(strDir As String, strfilter As String) As String
Dim fileopen As Object ' MSComDlg.CommonDialog.1
On Error GoTo cancelerr
Set fileopen = CreateObject("MSComDlg.CommonDialog")
fileopen.CancelError = True
' Set flags
'' fileopen.Flags = cdlOFNPathMustExist
fileopen.InitDir = strDir
' ' Set filters
fileopen.Filter = strfilter '"EDI322Files (*.mfd)|*.mfd"
' Specify default filter
fileopen.FilterIndex = 2
' Display the Open dialog box
' Must have one *.mfd in the folder to start.
fileopen.ShowOpen
' Display name of selected file
getfile = fileopen.filename
Set fileopen = Nothing
Exit Function
cancelerr:
getfile = ""
Set fileopen = Nothing
End Function
Set fileopen = CreateObject("MSComDlg.CommonDialog") this is the
C:\WINDOWS\SYSTEM32\comdlg32.ocx
this works in my office 2000
when I send the Access to a client they get an error, in Access2002.
the expression you entered as a event property setting produced the
following error:
the action requires a filename aurgment.
here is the code:
routine 1
Dim filename
filename = getfile(CurrentProject.Path, "EPOSTAGE*.txt)|EPOSTAGE*.txt")
If InStr(filename, "no files found.") > 0 Then
MsgBox " unable to find Endicia export file EPOSTAGE*txt)"
Exit Sub
End If
routine 2
Function getfile(strDir As String, strfilter As String) As String
Dim fileopen As Object ' MSComDlg.CommonDialog.1
On Error GoTo cancelerr
Set fileopen = CreateObject("MSComDlg.CommonDialog")
fileopen.CancelError = True
' Set flags
'' fileopen.Flags = cdlOFNPathMustExist
fileopen.InitDir = strDir
' ' Set filters
fileopen.Filter = strfilter '"EDI322Files (*.mfd)|*.mfd"
' Specify default filter
fileopen.FilterIndex = 2
' Display the Open dialog box
' Must have one *.mfd in the folder to start.
fileopen.ShowOpen
' Display name of selected file
getfile = fileopen.filename
Set fileopen = Nothing
Exit Function
cancelerr:
getfile = ""
Set fileopen = Nothing
End Function