Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I suppress pop ups... Getting pop ups when running a query from Excel on an Access table

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I have an excel macro that runs a query off a table in an access db.
I am calling it from Access in a function. That works fine, the only thing is I get a prompt
asking me if U want to connect to the database. I need this to run automatically.
If I click "Yes", I get the data link properties pop up which I have to click OK, then I get
the OLE DB Initialization pop up and click ok again. Then the query runs and fills the spreadsheet with the fields.
How can I suppress these pop ups.

Thanks....Here is the macro that runs in Excel.




Sub Get_Combined_Quality_Tracker()
'
' Get_Combined_Quality_Tracker Macro
'

'
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=S:\Global Metrics\Work In Progress\Global Metrics - Qual" _
, _
"ity.mdb;Mode=Share Deny Write;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database " _
, _
"Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk " _
, _
"Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OL" _
, _
"EDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Comp" _
, "lex Data=False"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdTable
.CommandText = Array("Combined Quality Tracker")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.SourceDataFile = _
"S:\Global Metrics\Work In Progress\Global Metrics - Quality.mdb"
.ListObject.DisplayName = "Table_Global_Metrics___Quality"
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.Save
End Sub
 
Hi,

This is really a forum707 question.

I use OBBC rather than OLEDB, and never have had the issue you posted.

Secondly, you have recorded ADDING the QueryTable, rather than EDITING the QueryTable and the File > Return Data to Excel. Exact time you run this code you add another QueryTable object to your sheet, needlessly!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top