Hello,
Is there anyway to call query which in stored in MS Access through Excel?.
any small help would be appreciated.
Thanx in Advance.
eg:"Query5" saved in CustomerDB.accdb
Hello,
Is there anyway to call query which in stored in MS Access through Excel?.
any small help would be appreciated.
Thanx in Advance.
eg:"Query5" saved in CustomerDB.accdb
Did you try Data > Get External Data from Excel ribbon?
Do you want to use VBA in Excel to connect to Access?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yes VBA code.
I know how to build SQL query
but not sure about how to call stored query in ms access (which already created in Ms Access).
I didn't ask if you know how to build SQL query. I asked if you tried the import wizard in Excel.
Here is example of opening a recordset of Access data with VBA in Excel:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source='\\dotatufs02\CRM\Lab\Database\Data\LabData .accdb'"
rs.Open "SELECT DISTINCT ProjectName FROM GeoDataAll;", cn, adOpenStatic, adLockReadOnly
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
thanx for reply...
this is all about how to creation of SQL query.
But I am looking for how to call query which already created and stored in ms access.
Because sometimes its hard and time consuming to create complex query for me.
My question is why are you using Excel and Access? What is the problem/opportunity being solved -in simple plain English?
As orange states, we need more info.
So what is it exactly you want to do from Excel? Why is Excel involved? What bearing does 'calling' a saved query in Access have to do with "hard and time consuming to create complex query"? You said you know how to build SQL query.
I already gave you two options for 'calling' a saved Access query object.
1. Excel import wizard
2. VBA in Excel that opens recordset object
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.