I have an excel sheet, which I have pulling data from an access query. The query has many aggregrate functions.
I want to prompt the user to enter a date, this is performance related data, and I want to choose an end date for the data. I do this in query by just adding the following clause to the query
WHERE (((tblPerformance.ladder_date)<=[Enter End Date]));
and if you executed the query in excel you get a date prompt.
I made a macro which is just pushing a button to execute the query (see below code).
Is it possible to pass something to query from excel? or am just stuck?
note: I am using excel because this data is being feed into presentation slides in excel, and linked tables weren't working due to SP2 issues.
Thanks
Sub GetPerformance1()
'
' GetPerformance1 Macro
' Macro recorded 6/2/2006 by Alex Henderson
'
'
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Documents and Settings\ahenderson\My Documents\may25.m" _
, _
"db;Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB
atabase Passw" _
, _
"ord="""";Jet OLEDB:Engine Type=5;Jet OLEDB
atabase Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Trans" _
, _
"actions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB
" _
, _
"on't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("qry_Performance2")
.Name = "may25"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"C:\Documents and Settings\ahenderson\My Documents\may25.mdb"
.Refresh BackgroundQuery:=False
End With
Sheets("Sheet1").Select
End Sub
I want to prompt the user to enter a date, this is performance related data, and I want to choose an end date for the data. I do this in query by just adding the following clause to the query
WHERE (((tblPerformance.ladder_date)<=[Enter End Date]));
and if you executed the query in excel you get a date prompt.
I made a macro which is just pushing a button to execute the query (see below code).
Is it possible to pass something to query from excel? or am just stuck?
note: I am using excel because this data is being feed into presentation slides in excel, and linked tables weren't working due to SP2 issues.
Thanks
Sub GetPerformance1()
'
' GetPerformance1 Macro
' Macro recorded 6/2/2006 by Alex Henderson
'
'
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:=Array( _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Documents and Settings\ahenderson\My Documents\may25.m" _
, _
"db;Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB
, _
"ord="""";Jet OLEDB:Engine Type=5;Jet OLEDB
, _
"actions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB
, _
"on't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False" _
), Destination:=Range("A1"))
.CommandType = xlCmdTable
.CommandText = Array("qry_Performance2")
.Name = "may25"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"C:\Documents and Settings\ahenderson\My Documents\may25.mdb"
.Refresh BackgroundQuery:=False
End With
Sheets("Sheet1").Select
End Sub