|
-
Jun 4th, 2003, 09:38 AM
#1
Thread Starter
Member
Pull word Doc from Access database..
I have a program that I am writing to save word docs to a database. I would like to save the docs in the database this seems easy enough, but how can I pull those documents out of the DB to allow the user to view using a command button, or whatever I decide.???
I am able save the doc to the DB, but I am not sure after that.
What I want to do is...... I have several docs that pertain to certian customer, or sales rep. I would like to be able to allow the user to search through the database based upon customer, or sales rep criteria and then select the doc they want to see from that filtered down criteria. I am not sure if I am going to use a datagrid to dispaly the criteria they filtered, then allow them to double click on the item they want then dispaly the doc.. At this point I am not sure how I am going to do it....... because I am not even sure how to pull the doc out of the DB.. Please point me in the right direction..... Thanks
-
Jun 4th, 2003, 10:41 AM
#2
Easiest way is to have a folder near to the mdb where you store the Doc files.
Then store a path to the doc files and open these in word (automation) as read only... if you want.
Storing the doc in a db doesn't seem to be a good idea, but if you need to go that way, either open word (automation) then paste the doc in, possibly via clipboard, or go through what is held and write it to the doc.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 8th, 2003, 09:42 PM
#3
PowerPoster
Okay so you've read my tutorial thingy on Saving Any File Type.
It contains a few vital procedures that do all the work.
Do you get how to add and retrieve files from a db?
Do you have it working?
If so for the searching part simply add some fields like filename, date modified, summary etc.
They can search\view it by those fields.
Does that make sense?
b
-
Jun 10th, 2003, 10:02 AM
#4
Thread Starter
Member
How to open or retrieve file..
I am able to add the WORD Docs to the db.. Now how do I retrieve them?? I would like to be able to let the user select the word doc with a click event on a datagrid, or just use a command button to pull and open the word docs in MSWORD. so far I am able to pull the doc just using the file name, but this just kind of defeats the purpose of storing the docs in the db.. Please give me a clue.... Thanks...
-
Jun 12th, 2003, 01:13 AM
#5
PowerPoster
By the filename i meant store that AS well, it just looks better.
Now retrieving data out is in my thread about Storing Any File Type In A Database
For Word Docs what i'd do is use the shell execute function
VB Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_MAXIMIZE = 3
Private Sub cmdGet_Click()
'check for temporary file if it's found delete it
temp = App.Path & "\" & txtfilename.Text 'txtfilename holds the files name
If Len(Dir(temp)) > 0 Then
Kill temp
End If
'Open temp file
file = FreeFile
Open temp For Binary As #file
'Read temp file as binary into chunk
'this is the engine room
ImgeSze = rs("FILE").ActualSize
Do While offset < ImgeSze
chunk() = rs("FILE").GetChunk(ChunkSize)
Put #file, , chunk()
offset = offset + ChunkSize
Loop
Close #file
ShellExecute Me.hwnd, vbNullString, temp ,vbNullString, vbNullString, SW_MAXIMIZE
'this is to load it's path name into the text box
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|