Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   Want Button on Access Form for Inserting OLE Object into Table (https://www.askmehelpdesk.com/showthread.php?t=204648)

  • Apr 10, 2008, 08:10 PM
    linkinfinity
    Want Button on Access Form for Inserting OLE Object into Table
    Hi.

    I'm looking for a simple simple simple solution that will allow me to add a button to an Access form. When the button is clicked, a File Dialog box should appear allowing me to pick any file to insert into the OLE package.

    I've searched every corner of the web and have found a lot of suggestions that are close, but most are either too complex (using API) or are focused on something specific (like inserting .xls files only).

    Can anyone help?

    Much appreciated!
  • Apr 11, 2008, 05:54 AM
    ScottGem
    The answer is using the API. Sorry, but there is no simple way. If you use the Code here:
    API: Call the standard Windows File Open/Save dialog box

    You can do this (its what I use). Its not that difficult. The code behind your button would look like this:

    strInputFileName = ahtCommonFileOpenSave(InitialDir:="K:\Transcar", _
    Filter:=strFilter, OpenFile:=True, Flags:=ahtOFN_HIDEREADONLY, _
    DialogTitle:="Select File for Input...")

    This opens the File>Open dialog to the folder K:\Transcar. You can leave out the Filter argument if you want to show all files.

  • All times are GMT -7. The time now is 10:10 PM.