Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
access to excel
i'm trying to view some data from access in excel. i'm using code found
on this site written in excel as shown below but excel seems to fail to recognise the datatype "Database". Any ideas? Sub DAOCopyFromRecordSet() '"C:\db1.mdb" As _ String, "dbt_Pruefbericht" As String, "dbf_MessDaten" As _ String, Range("A1") As Range) ' Example: DAOCopyFromRecordSet "C:\FolderName\db1.mdb", "TableName", "FieldName", Range("C1") Dim db As Database Dim rs As Recordset Dim intColIndex As Integer Set TargetRange = TargetRange.Cells(1, 1) Set db = OpenDatabase("C:\db1.mdb") Set rs = db.OpenRecordset("dbt_Pruefbericht", dbOpenTable) _ ' all records 'Set rs = db.OpenRecordset("SELECT * FROM " & TableName _ & " WHERE " & FieldName & " = 'MyCriteria'", dbReadOnly) ' filter _ records ' write field names For intColIndex = 0 To rs.Fields.Count - 1 TargetRange.Offset(0, intColIndex).Value = rs.Fields(intColIndex).Name Next ' write recordset TargetRange.Offset(1, 0).CopyFromRecordset rs Set rs = Nothing db.Close Set db = Nothing End SubDatabase |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
access to excel
cheers Tom it now recognises Database as well as other objects
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Query from Access into Excel cause Access to go to read only | Excel Discussion (Misc queries) | |||
Can Excel access data from Access?! | Excel Discussion (Misc queries) | |||
Macro to check data from excel list against access query and return value back to excel | Excel Worksheet Functions | |||
Access Form In An Access Report (SubForm) Question | Links and Linking in Excel | |||
export access to excel. change access & update excel at same time | Excel Discussion (Misc queries) |