Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unhappy Unanswered: Opening a picture using the path from an edit box

    I got a problem. My table has a column called Picture where u can put the name of a picture with full path something like c:\newfolder\picture.jpg. What I want to do is to build an event for a button that once clicked opens that picture in Irfan View.

    What code should i use for that button?

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    on a form place an unbound picture control called imgImages

    lets say you have the list of picure paths in a table

    place a listbox on the form as well the list box is called lstpics

    on the click event of a button

    imgImages.picture = lstpics.column(0)



    'where the lstpics.column(0) represents the bound column of the row source which is the path stored in a table
    Dale Houston, TX

  3. #3
    Join Date
    Feb 2004
    Posts
    25
    the followin works for any file type with the right associations set up.
    just call the run_Doc function with your txtFilename field...

    Const SW_SHOWNORMAL = 1

    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Function run_Doc(p_DocName As String)
    On Error GoTo run_Doc_Error

    run_Doc = ShellExecute(Application.hWndAccessApp, "Open", p_DocName, "", "c:\", SW_SHOWNORMAL)
    Exit Function

    run_Doc_Error:
    MsgBox "Error: " & Err & ", " & Error
    run_Doc = False
    End Function

    Function test_run_Doc()
    Call run_Doc("c:\my pictures\my.jpg")
    End Function

  4. #4
    Join Date
    Mar 2004
    Posts
    2

    Re: Opening a picture using the path from an edit box

    I have a table called "TableName" with two columns: one called "id" that is auto number and is primary key and one called "file" that is text type.

    I also have a form called "FormName" with a listbox that is asociatted to the field "file" and a button that it doesn't do nothing. What should I do so the button once clicked opens a picture in Irfan View? The name and path of the picture should be read from the field "file".

    The listbox has the name "lstImage" and the button "cmdButton".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •