[AccessD] Insert Picture

MartyConnelly martyconnelly at shaw.ca
Sat Apr 9 13:29:34 CDT 2005


Have a look at Candace Tripps methods to call API file dialogs
for images or other files via filters for 97 and 2000
download Picture database and windows common dialogs
Similar to code on Dev Ashish's site http://www.mvps.org/access

http://www.candace-tripp.com/pages/access_downloads.aspx

Barry Stear wrote:

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

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list