Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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
 
Old February 7th, 2005, 10:56 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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,

 
Old February 7th, 2005, 12:29 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

 
Old February 7th, 2005, 02:33 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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,

 
Old February 8th, 2005, 12:06 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

 
Old February 10th, 2005, 12:16 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Save xlsheet file in a database nachi_hota ADO.NET 1 August 4th, 2006 05:08 AM
SQL 2000 database / text file / binary file pallone Javascript How-To 3 January 28th, 2005 01:26 PM
File to binary and save as string eelisMX Pro VB.NET 2002/2003 4 December 8th, 2004 10:26 AM
How to get File type before save to database. monika_jain_99 Pro JSP 1 July 19th, 2003 05:00 AM
How to get File type before save to database monika_jain_99 J2EE 0 July 9th, 2003 07:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.