Open File

  • Thread starter Thread starter msnnews.msn.com
  • Start date Start date
M

msnnews.msn.com

Using Access 2000

I have a table that contain Excel, Word and Text files.

Is there some secret code that would allow me to open these files within
Access?
 
Hi,

the two links are to a couple of posts detailing how to open files.

http://groups-beta.google.com/group...8a804cc855?q=xwordobj&rnum=2#c58a0a8a804cc855

http://groups-beta.google.com/group...bf16047432?q=xwordobj&rnum=1#5fe926bf16047432

some code to write documents into an image field

Dim adoDocument As New ADODB.Recordset
Dim mStream As ADODB.Stream
Dim SQL As String
SQL = "Select Doc_Embed,FileName from TblCandidate_Contact_History
Where Candidate_Contact_History_ID=" & strID
Set adoDocument = New ADODB.Recordset
adoDocument.Open SQL, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
Set mStream = New ADODB.Stream
With mStream
.Type = adTypeBinary
.Open
.LoadFromFile strFileName
End With
With adoDocument
.Fields("Doc_Embed").Value = mStream.Read
.Fields("Filename").Value = strFileName
.Update
.Close
End With


some code to write the document out to the temp folder

Dim adoDocument As New ADODB.Recordset
Dim mStream As ADODB.Stream
Dim SQL As String
Dim strTemp As String
strTemp = Environ("Temp")
SQL = "Select Doc_Embed from TblCandidate_Contact_History Where
Candidate_Contact_History_ID=" & strID
Set adoDocument = New ADODB.Recordset
adoDocument.Open SQL, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
Set mStream = New ADODB.Stream
With mStream
.Type = adTypeBinary
.Open
.Write adoDocument.Fields("Doc_Embed").Value
.SaveToFile strTemp & "\" & strID & ".doc",
adSaveCreateOverWrite
End With
ReadFromDB = strTemp & "\" & strID & ".doc"
adoDocument.Close

using the above code with the 2 post above should get you on your way.

Any problems post back

Regards

Alex
 
Back
Top