Unanswered: Help with error while trying to Insert Picture from file into Form
I'm hoping that someone knows what I'm doing wrong and can help me with this. Thanks in advance.
I'm trying to insert a picture into a form in the exact same way that the Northwind sample database does in the Employees form. So far I've copied the code and made minimal changes in order to get some of the fields to match up to my db, however I'm getting an error that doesn't seem to make sense.
The error is:
Variable not defined
This error points to the following subroutine and highlights msoFileDialogFilePicker on line 7
Any ideas as to why this works in the Northwind sample db but not mine?
' Displays the Office File Open dialog to choose a file name
' for the current employee record. If the user selects a file
' display it in the image control.
Dim fileName As String
Dim result As Integer
.Title = "Select Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "JPEGs", "*.jpg"
.FilterIndex = 3
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![ImagePath].Visible = True
Me![ImagePath].Text = fileName
Me![ImagePath].Visible = False