transferring data from access to excel

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

I'm using office 97 and am tryin to get some data from
access to excel. With the code I've written in excel all
that is displayed in the label is the default caption.
How can I display what is in varVariable? Thanks for any
help.

This is my code:

Option Explicit

Sub Data()
lblDat.Caption = varVariable()
End Sub

Function varVariable() As Variant

Dim dbsNozztst As Database
Dim rstLngBinDat As Recordset
Const conChunksize As Long = 32768

'open database "db1.mdb" and recordset "dbt_Pruefbericht"
Set dbsNozztst = OpenDatabase("C:\db1.mdb")
Set rstLngBinDat = dbsNozztst.OpenRecordset
("dbt_Pruefbericht")

'use GetChunk method to assign long binary data to a
variable
varVariable = rstLngBinDat!dbf_MessDaten.GetChunk(0,
conChunksize)

'close database and recordsets
dbsNozztst.Close

End Function
 
Thanks for all your help. What I'm trying to do is move
some data stored as an OLE object from access to excel in
the hope that I'll be able to view it as numerical values
which is what I think it is. The data comes directly from
a machine which measures the height of water in 48
separate glasses. At the moment all I see is "long binary
data" in the field dbf_messdaten.

Dave
 
dave said:
Thanks for all your help. What I'm trying to do is move
some data stored as an OLE object from access to excel in
the hope that I'll be able to view it as numerical values
which is what I think it is. The data comes directly from
a machine which measures the height of water in 48
separate glasses. At the moment all I see is "long binary
data" in the field dbf_messdaten.

Dave

Long binary data is unlikely to be simple numeric values.
Typically this type is used to store binary files such
as images.

You really need to know the data format before you
can make a sensible use of it.

Keith
 
I thought that might be the case. It may be that I can
decipher the binary numbers when I see them which is why
I'm still trying.

Dave
 
There is no documenation on what the machine is doing and what it might be
putting in the field? (and how you might read that information)
 
I've written some code and used the hex editor. All I get
is a few random numbers and symbols on the first few
lines then loads and loads of zeros. Is this what I
should expect or have I done something wrong? Here is the
procedure I've written.

Option Compare Database
Option Explicit
Const conChunksize As Long = 32768

Sub SaveDatToFile()

Dim FileNum As Integer
Dim dbsNozztst As Database
Dim rstLngBinDat As Recordset
Dim FileData As Variant

'Open "db1.mdb" database and "dbt_Pruefbericht" recordset
Set dbsNozztst = OpenDatabase("C:\db1.mdb")
Set rstLngBinDat = dbsNozztst.OpenRecordset
("dbt_Pruefbericht")

'Open "MeasuredData" file to store data
FileNum = FreeFile()
Open "C:\Documents and Settings\brad\My
Documents\MeasuredData.doc" For Binary As FileNum

'Assign data to FileData variable
FileData = rstLngBinDat!dbf_MessDaten.GetChunk(0,
conChunksize)

'Write FileData variable to MeasuredData file
Put FileNum, , FileData

'Close MeasuredData
Close FileNum

End Sub
 
I wish. I've spent the last 6 weeks trying to get such
information. Problem is was built by an Austrian company
6 yrs ago and unfortunately the Austrian guys are not
very forthcoming with information.
 
dave said:
I've written some code and used the hex editor. All I get
is a few random numbers and symbols on the first few
lines then loads and loads of zeros. Is this what I
should expect or have I done something wrong? Here is the
procedure I've written.

It sounds like the zeroes are padding to make up the
required dataset length, the odds are the developers
used their own algorithms to store the data.

You need either solid data about the format or
some reference output to compare the dataset
with.

Keith
 
Back
Top