[AccessD] Insert Picture

Nicholson, Karen cyx5 at cdc.gov
Fri Apr 8 12:31:23 CDT 2005


Check the references.  I think that is the one that requires Microsoft
Office 10.0 or greater to work.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Barry Stear
Sent: Friday, April 08, 2005 1:27 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Insert Picture


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
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list