[AccessD] Insert Picture

Barry Stear bstear at gmail.com
Fri Apr 8 12:26:51 CDT 2005


I copied the EVENT for inserting an picture from the Sample Database
that comes with Access 2003 (NorthWind Sample Database) . However when
I try to click on the button to insert an picture it errors out in the
code at Sub getFileName(). It says that its not defined. It highlights
in blue msoFileDialogFilePicker and has an Yellow Arrow next to Sub
getFileName(). Here is the procedure.

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 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


Anyone help me with this code or perhaps something else I can use. I
want to be able to put an picture in my Inventory list. I know I can
embed it but its nice to be able to do it from within an form with an
button.

Barry



More information about the AccessD mailing list