Hello all:
I'm trying to create a browse button in MS Access. Here is the code I've used so far:
Private Sub ImgBrowse_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click
' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([ImageFullPath]) Then .lpstrFile = [ImageFullPath]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With
If OpenDialog(OFN) Then
[ImageFullPath] = OFN.lpstrFile
[ImagePicture].Picture = [ImageFullPath]
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [ImageFullPath] & "'."
End If
Form.Refresh
Exit Sub
Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub
and here is what is in my module:
Option Compare Database
Public Type OPENFILENAME
lpstrTitle As String
lpstrFile As String
flags As Long
lpstrFilter As String
End Type
When I attempt to compile it says Sub or function not defined and highlights MakeFilterString. Why is this and how can I fix it? An ideas? Thank you
I'm trying to create a browse button in MS Access. Here is the code I've used so far:
Private Sub ImgBrowse_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click
' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([ImageFullPath]) Then .lpstrFile = [ImageFullPath]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With
If OpenDialog(OFN) Then
[ImageFullPath] = OFN.lpstrFile
[ImagePicture].Picture = [ImageFullPath]
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [ImageFullPath] & "'."
End If
Form.Refresh
Exit Sub
Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub
and here is what is in my module:
Option Compare Database
Public Type OPENFILENAME
lpstrTitle As String
lpstrFile As String
flags As Long
lpstrFilter As String
End Type
When I attempt to compile it says Sub or function not defined and highlights MakeFilterString. Why is this and how can I fix it? An ideas? Thank you