J
Joe Cilinceon
I would like to be able to add a pictures of a persons driver's license/ID
(we make scan of them for every tenant) appear on the tenant's forms. Now
I'm trying the method used in Northwind sample. I copied all the code and
objects, even making sure I named them the same and all properties where the
same. Now the form loads fine until I hit the add/change button on my form.
At that point I get a Run-time erro '-2147467259 (800004005): Method
'FileDialog' of object'_Application' failed. The code is taken straight from
the Northwind and added to my form as below:
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) -----the debugger
points here.
.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "Bitmaps", "*.bmp"
.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![FirstName].SetFocus
Me![ImagePath].Visible = False
End If
End With
End Sub
Now it is working fine in Northwind but in my database I get the error
above. What am I missing here. Oh and I have Office XP Pro and the database
is Access 2000 file format.
(we make scan of them for every tenant) appear on the tenant's forms. Now
I'm trying the method used in Northwind sample. I copied all the code and
objects, even making sure I named them the same and all properties where the
same. Now the form loads fine until I hit the add/change button on my form.
At that point I get a Run-time erro '-2147467259 (800004005): Method
'FileDialog' of object'_Application' failed. The code is taken straight from
the Northwind and added to my form as below:
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) -----the debugger
points here.
.Title = "Select Employee Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "JPEGs", "*.jpg"
.Filters.Add "Bitmaps", "*.bmp"
.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![FirstName].SetFocus
Me![ImagePath].Visible = False
End If
End With
End Sub
Now it is working fine in Northwind but in my database I get the error
above. What am I missing here. Oh and I have Office XP Pro and the database
is Access 2000 file format.