 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 7th, 2005, 10:56 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Save BINARY FILE in ACCESS database
Hi,
How can I save a binary file (word document, PDF, JPEG etc...) in a ACCESS 2003 database ? (I don't want to save a path, but the complete FILE) Is there a tutorial available for such thing ?
Thank you,
Adi,
|
|

February 7th, 2005, 12:29 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Adi,
You can create a table with a column that has a data type of OLE Object.
In that, you can store pictures, documents, etc. To insert the file, open the table, right click on the column, then choose - insert object. This will store the file.
Good Luck,
Kevin
|
|

February 7th, 2005, 02:33 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Thx for the help. But in the column I only see the OBJECT TYPE ex: Adobe Acrobat PDF, how can I set to see what is the current object filename ?
Thx,
Adi,
|
|

February 8th, 2005, 12:06 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Adi,
Took me a few hours to figure it out, so try this.
Add a text column to your table and call it Location.
Set the length to what you might need for the full path.
create a form from the table.
create a command button to insert the picture and path.
in the on click use this expression:
Private Sub Command_Click()
Dim fd As FileDialog
Dim vrtSelectedItem As Variant
Dim ctl As Control
Set ctl = Me.Object 'this is the field name of your object
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
Me.location = vrtSelectedItem
Next vrtSelectedItem
Else
End If
End With
With ctl
.Enabled = True
.Locked = False
.OLETypeAllowed = acOLEEmbedded
.SourceDoc = Me.location
.Action = acOLECreateEmbed
End With
Set fd = Nothing
Me.Picture.SetFocus
end sub
Once you're done, use the form to insert your object and it will insert the object into the object column along with the complete path name in the location column.
Good Luck,
Kevin
|
|

February 10th, 2005, 12:16 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Adi,
Just wondering if that worked for you. Depending on your version of access, you might be missing a reference. If you need a list, let me know.
Kevin
|
|
 |