Excel

Extract Data from Access to Excel

Ease of Use

Intermediate

Version tested with

2007 

Submitted by:

Mohideen

Description:

SQL Query for pulling data from Access to Excel 

Discussion:

SQL Query for pulling data from Access to Excel 

Code:

instructions for use

			

Dim varConnection Dim varSQL Sheet2.Cells.Range("A1").CurrentRegion.ClearContents varConnection = "ODBC; DSN=MS Access Database;DBQ=full path + file name with extension Driver={Driver do Microsoft Access (*.mdb)}" varSQL = "SELECT CONCATENATE,DATEE,EMPLOYEE,TEAMLEADER,LOCATION,CALLSANSWERED,AHT,OUTBOUNDCALLS,AVGOUTBOUNDTALKTIME,UTILIZATION FROM Callsdata where LOCATION=" & "'" & Sheet1.ComboBox5.Text & "'" With Sheet2.QueryTables.Add(Connection:=varConnection, Destination:=Sheet2.Cells.Range("A1")) .CommandText = varSQL .Name = "Query-39008" .Refresh BackgroundQuery:=False End With

How to use:

  1. Paste this code on any command button for this event to be triggered.
 

Test the code:

  1. Already Tested & under usage
 

Sample File:

No Attachment 

Approved by Jacob Hilderbrand


This entry has been viewed 362 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express