View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dave dave is offline
external usenet poster
 
Posts: 4
Default transferring data from access to excel

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