I have an Access Database which I use for controlling and calculating large volumes of data (too big for Excel to cope with). However the summaries from this data (a series of queries and crosstabs) for this need to be put into Excel for reporting purposes. I would like to be able to click a command button in Excel and pull the data over from the database. The macro I currently have in my Excel workbook, which has been gathered through research on other forums, does not pull the headings over:
Could someone please help with applying the headings to the macro.
Thank you.
HTML:
Sub Query()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sql As String
Range("A:F").Select
With Selection.ClearContents
End With
Set db = OpenDatabase("C:\Personal Data\zgd81463\Training\Training.mdb")
Set rst = db.OpenRecordset("X_ProjectGroup")
ActiveSheet.Range("A2").CopyFromRecordset rst
rst.Close
db.Close
Set rst = Nothing
Set db = Nothing
End Sub
Could someone please help with applying the headings to the macro.
Thank you.