Hello,

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:
Compile Error:
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?

Sub getFileName()
' 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
With Application.FileDialog(msoFileDialogFilePicker)
.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].SetFocus
Me![ImagePath].Text = fileName
Me![Name].SetFocus
Me![ImagePath].Visible = False
End If
End With
End Sub