Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Creating a file from and OLE Object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim - 18 Jun 2007 20:59 GMT
I have a Dlls stored in an OLE Object field in my database that i put there
by copy/paste into the table.  What I want to do is check to see if the file
exists in the folder with the database at main form open and if not write the
file from the database to the folder.  I have found an example to write excel
and word files but nothing for other file types.  I also looked at Stephen
Lebans's site and found a procedure to do this but it requires a dll in the
folder with the database which puts me back at my original issue, the dlls
may not be there...

Thanks for your help,

Jim
Douglas J. Steele - 18 Jun 2007 21:52 GMT
Take a look at what Peter Walker has at
http://www.papwalker.com/dllhell/index.html

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)

>I have a Dlls stored in an OLE Object field in my database that i put there
> by copy/paste into the table.  What I want to do is check to see if the
[quoted text clipped - 12 lines]
>
> Jim
Jim - 21 Jun 2007 15:29 GMT
Doug,

My question really has nothing to do with registering dlls or dlls
specifically.  All I want to do is press a button on a form that gets the
file c:\abc.dll from the drive, writes it into an OLE Object field
fldRequiredFiles in table tblFiles.  Then have another button that takes the
file from the table and writes it to the drive.

From what I have learned so far is, the Copy/Paste of the file from the
drive to the OLE field causes it to show up in datasheet view as "Package"
I've been told it should say "Long Binary Data".  The problem with the
"Package" is that when I "put" the OLE data to disk the file ends up 1k
larger than the original which causes the dll not to work.

I was able to code a "get" that reads the file and writes it to the OLE
field, it does appear as "Long Binary Data" in datasheet view however, it
only gets 1k and the file is 88k, when I "put" the file back to disk it is 1k
in size.

Thanks for any help,

Jim

> Take a look at what Peter Walker has at
> http://www.papwalker.com/dllhell/index.html
[quoted text clipped - 15 lines]
> >
> > Jim
Douglas J. Steele - 21 Jun 2007 16:38 GMT
It's been a while since I've looked at Peter's database, but I thought
that's what it did: stored the dlls as blobs in the database, and then wrote
the files out to the hard drive if necessary.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Doug,
>
[quoted text clipped - 44 lines]
>> >
>> > Jim
Jim - 21 Jun 2007 17:55 GMT
Doug,

I created a new database, brought in the code, and ran it.  It created the
Libraries table and put a couple of files in it.  I deleted the data in the
table and attempted to call the PackRefs sub routine with PackRefs "text",
"me.txt", "C:", "" and PackRefs "text", "me.txt", "C:\", "".  I have a me.txt
file in the root of C:, I was just trying to see if I could get anything to
work.  The routine errors out at "ReDim bData(0 To FileSize - 1) As Byte"
with "9 Subscript out of range".  Any suggestions?

I'm trying to cut down the code to only what I need to accomplish the
seemingly simple task of reading and writing a file...

Thanks,

Jim

> It's been a while since I've looked at Peter's database, but I thought
> that's what it did: stored the dlls as blobs in the database, and then wrote
[quoted text clipped - 48 lines]
> >> >
> >> > Jim
Douglas J. Steele - 21 Jun 2007 18:29 GMT
What did you pass as strFileName to PackRefs? Was it an existing file?

Put a break point in PackRefs right after the line rst.AddNew. What value is
returned for hFile by the call to CreateFile? What value is returned for
FileSize by the call to GetFileSize?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Doug,
>
[quoted text clipped - 78 lines]
>> >> >
>> >> > Jim
Jim - 21 Jun 2007 20:15 GMT
Doug,

The call was PackRefs "text", "me.txt", "C:\", ""
strRefName = "text"
strFileName = "me.txt"
strFullPath = "C:\" I also tried it without the "\"
strGUID = "" I also tried it with strGUID = "1"

GENERIC_READ = -2147483648
FILE_SHARE_READ = 1
FILE_SHARE_WRITE = 2
OPEN_EXISTING = 3
hFile returned = -1

FileSize = -1

Hope this helps... Thanks again,

Jim

> What did you pass as strFileName to PackRefs? Was it an existing file?
>
[quoted text clipped - 84 lines]
> >> >> >
> >> >> > Jim
Douglas J. Steele - 21 Jun 2007 20:42 GMT
I believe you need to pass the full path to the file:

PackRefs "text", "me.txt", "C:\me.txt", ""

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Doug,
>
[quoted text clipped - 121 lines]
>> >> >> >
>> >> >> > Jim
Jim - 21 Jun 2007 21:34 GMT
Doug,

That was it, it works.  I was able to read in/write out the dlls and run the
application that uses the dlls and it works...

Thanks for your patients,

Jim

> I believe you need to pass the full path to the file:
>
[quoted text clipped - 125 lines]
> >> >> >> >
> >> >> >> > Jim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.