Macro to place attachment file to access?

stafire_18

Board Regular
Joined
Dec 8, 2004
Messages
162
is this possible? what i would like is a command button if it's click it'll give me the option to include a file from a location on my pc. would it be possible to save it to the database? or any suggestions on this?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Don't quite understand what you want to accomplish. Are you trying to save a photo in the database? If so, which table do you want to save it to. What other fields are going to be in the table. Or, do you want to only save the address of the file within the database. There are so many different types of files available on a pc, trying to include any of these files into a database is not really a good way to gain access to these files.

Please try to expand the explanation of what you want.
 
Upvote 0
just like a check mark box. that when i click it, it will then give me the option to add a file to the database just as an image file. I appologize if i'm not explaining this clearly. lets just go with a jpeg file. is there anyway to add a jpeg file to the database in a table or report or anywhere?
 
Upvote 0
Here is the code that I have done as a test some time back:
Code:
Private Sub Command4_Click()
    Dim conUserCancelled As Integer

    ' Error message returned when user cancels.
    conUserCancelled = 2001
    On Error GoTo ButtonErr
    If BoundOLE.OLEType = acOLENone Then
        ' No OLE object created.
        ' Display Insert Object dialog box.
        BoundOLE.Action = acOLEInsertObjDlg
    End If
    Exit Sub

ButtonErr:
    If Err = conUserCancelled Then ' Display message.
        MsgBox "You clicked the Cancel button; " _
            & "no object was created."
    End If
    Resume Next

End Sub
The table field that this OLE object is being put into is a "OLE Object" data type. It can be a Word document, a jpeg, a wave file, etc.
HTH,
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top