boomerang boi
Registered User.
- Local time
- Today, 20:00
- Joined
- Apr 14, 2008
- Messages
- 16
I'm having some problems with this code
I always get a variable not defined error when I execute this. The texts in the bold font is the one which the error occurs. Is there something wrong with the code?
Code:
Private Sub AddPicture_Click()
getFileName
End Sub
Sub getFileName()
Dim fileName As String
Dim result As Integer
With Application.FileDialog([B]msoFileDialogFilePicker[/B])
.TITLE = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "GIFs", "*.gif"
.FilterIndex = 3
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
.Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![ImagePath].Visible = True
Me![ImagePath].SetFocus
Me![ImagePath].Text = fileName
Me![FirstName].SetFocus
Me![ImagePath].Visible = False
End If
End With
End Sub
I always get a variable not defined error when I execute this. The texts in the bold font is the one which the error occurs. Is there something wrong with the code?