Connecting Tech Pros Worldwide Forums | Help | Site Map

Attaching files to an Access db

Mark
Guest
 
Posts: n/a
#1: Oct 31 '06
I know that you can format url's withing an Access database but can you
physically attach Word, Excel or pdf files within one? I need to attach
backup documents into a database I am creating. Any suggestions for a
workaround or alternative solution? Thanks

Mark



David W. Fenton
Guest
 
Posts: n/a
#2: Oct 31 '06

re: Attaching files to an Access db


"Mark" <m.doherty@snet.netwrote in
news:hRy1h.1737$wX.306@newssvr12.news.prodigy.com:
Quote:
I know that you can format url's withing an Access database but
can you physically attach Word, Excel or pdf files within one? I
need to attach backup documents into a database I am creating. Any
suggestions for a workaround or alternative solution?
There are OLE fields which allow you to embed the data in a table,
but that's not really very useful and bloats the database a great
deal. The only situation where I ever found it useful was in a
replicated environment, where two sites needed to share the same
documents.

Otherwise, I just store a path -- I don't even use hyperlinks (too
much trouble with the formatting/editing).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Bob Quintal
Guest
 
Posts: n/a
#3: Oct 31 '06

re: Attaching files to an Access db


"David W. Fenton" <XXXusenet@dfenton.com.invalidwrote in
news:Xns986DA463D31BDf99a49ed1d0c49c5bbb2@127.0.0. 1:
Quote:
"Mark" <m.doherty@snet.netwrote in
news:hRy1h.1737$wX.306@newssvr12.news.prodigy.com:
>
Quote:
>I know that you can format url's withing an Access database
>but can you physically attach Word, Excel or pdf files within
>one? I need to attach backup documents into a database I am
>creating. Any suggestions for a workaround or alternative
>solution?
>
There are OLE fields which allow you to embed the data in a
table, but that's not really very useful and bloats the
database a great deal. The only situation where I ever found
it useful was in a replicated environment, where two sites
needed to share the same documents.
>
Otherwise, I just store a path -- I don't even use hyperlinks
(too much trouble with the formatting/editing).
>
I've done it both ways. OLE fields are a PITA, Just storing the
path is also a problem when users move files.

So now I ask the user for the filename, and a description of
file contents, parse out the file extension, then assign a new
file number to the record, and copy the file to a subdirectory
specifically set up for the purpose.

Dim stSourceFile as string
dim stFileExtension as string
Dim stCopyOfFile as string
Const stStoreDirectory as string = "C:\Database\Attachments\"

stSourceFile = fGetSaveFile() ' from mvps or somewhere
stCopyOfFile = Me.ID ' grab the autonumber
stFileExtension = right(stSourcefile,4)

FILECOPY stsourcefile, _
stStoreDirectory _
& stCopyOfFile _
& stfileExtension

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Mark
Guest
 
Posts: n/a
#4: Nov 3 '06

re: Attaching files to an Access db


Bob, so it can be done! Where do I embed that code? Would it be a reference
within record say a field called Attachments or something? I am going to
save these files on a network server so users can access them from where
ever they are. Thanks


"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
news:Xns986DBB23746F5BQuintal@66.150.105.47...
Quote:
"David W. Fenton" <XXXusenet@dfenton.com.invalidwrote in
news:Xns986DA463D31BDf99a49ed1d0c49c5bbb2@127.0.0. 1:
>
Quote:
>"Mark" <m.doherty@snet.netwrote in
>news:hRy1h.1737$wX.306@newssvr12.news.prodigy.com :
>>
Quote:
>>I know that you can format url's withing an Access database
>>but can you physically attach Word, Excel or pdf files within
>>one? I need to attach backup documents into a database I am
>>creating. Any suggestions for a workaround or alternative
>>solution?
>>
>There are OLE fields which allow you to embed the data in a
>table, but that's not really very useful and bloats the
>database a great deal. The only situation where I ever found
>it useful was in a replicated environment, where two sites
>needed to share the same documents.
>>
>Otherwise, I just store a path -- I don't even use hyperlinks
>(too much trouble with the formatting/editing).
>>
>
I've done it both ways. OLE fields are a PITA, Just storing the
path is also a problem when users move files.
>
So now I ask the user for the filename, and a description of
file contents, parse out the file extension, then assign a new
file number to the record, and copy the file to a subdirectory
specifically set up for the purpose.
>
Dim stSourceFile as string
dim stFileExtension as string
Dim stCopyOfFile as string
Const stStoreDirectory as string = "C:\Database\Attachments\"
>
stSourceFile = fGetSaveFile() ' from mvps or somewhere
stCopyOfFile = Me.ID ' grab the autonumber
stFileExtension = right(stSourcefile,4)
>
FILECOPY stsourcefile, _
stStoreDirectory _
& stCopyOfFile _
& stfileExtension
>
--
Bob Quintal
>
PA is y I've altered my email address.
>
--
Posted via a free Usenet account from http://www.teranews.com
>
>

Bob Quintal
Guest
 
Posts: n/a
#5: Nov 3 '06

re: Attaching files to an Access db


"Mark" <m.doherty@snet.netwrote in
news:%oM2h.1288$r12.1268@newssvr12.news.prodigy.co m:
Quote:
Bob, so it can be done! Where do I embed that code? Would it
be a reference within record say a field called Attachments or
something? I am going to save these files on a network server
so users can access them from where ever they are. Thanks
>
The code would need some cleaning up before embedding it
anywhere, and where to embed it depends on several factors
pertinent to the specific needs of the database

In order to handle multiple attachments to a single main record,
I would probably build a separate table, with three fields,
specifically an autonumber primary ID, a field to store the
primary key of your main table, and a description field.
I'd then create a form or more likely a subform to the main
table's form that shows the existing attachments and a button to
open one. If the subform was on a new record, the button would
instead prompt the user to get the new attachment and then
execute the code snippet below, or some similar code.

The code below doesn't do anything to create the new record, or
populate the fields.Its purpose was to handle the specific
action of opening Windows File Dialog, then copy the file.
Quote:
>
"Bob Quintal" <rquintal@sPAmpatico.cawrote in message
news:Xns986DBB23746F5BQuintal@66.150.105.47...
Quote:
>"David W. Fenton" <XXXusenet@dfenton.com.invalidwrote in
>news:Xns986DA463D31BDf99a49ed1d0c49c5bbb2@127.0.0 .1:
>>
Quote:
>>"Mark" <m.doherty@snet.netwrote in
>>news:hRy1h.1737$wX.306@newssvr12.news.prodigy.co m:
>>>
>>>I know that you can format url's withing an Access database
>>>but can you physically attach Word, Excel or pdf files
>>>within one? I need to attach backup documents into a
>>>database I am creating. Any suggestions for a workaround or
>>>alternative solution?
>>>
>>There are OLE fields which allow you to embed the data in a
>>table, but that's not really very useful and bloats the
>>database a great deal. The only situation where I ever found
>>it useful was in a replicated environment, where two sites
>>needed to share the same documents.
>>>
>>Otherwise, I just store a path -- I don't even use
>>hyperlinks (too much trouble with the formatting/editing).
>>>
>>
>I've done it both ways. OLE fields are a PITA, Just storing
>the path is also a problem when users move files.
>>
>So now I ask the user for the filename, and a description of
>file contents, parse out the file extension, then assign a
>new file number to the record, and copy the file to a
>subdirectory specifically set up for the purpose.
>>
>Dim stSourceFile as string
>dim stFileExtension as string
>Dim stCopyOfFile as string
>Const stStoreDirectory as string = "C:\Database\Attachments\"
>>
>stSourceFile = fGetSaveFile() ' from mvps or somewhere
>stCopyOfFile = Me.ID ' grab the autonumber
>stFileExtension = right(stSourcefile,4)
>>
>FILECOPY stsourcefile, _
> stStoreDirectory _
> & stCopyOfFile _
> & stfileExtension
>>
>--
>Bob Quintal
>>
>PA is y I've altered my email address.
>>
>--
>Posted via a free Usenet account from http://www.teranews.com
>>
>>
>
>
>


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Closed Thread