Thanks Paul, that worked a charm. I could (and probably should) leave it there - I recorded the steps and I can just drop them into my code as is. But, I'm curious. Here's part of what I recorded ...
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _ "OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;Data Source=[source];Mode=Sha" _ , _ "re Deny Write; (and so on) I've never seen this type of arrangement before. The quotes delimit each line and the comma seams to break units up. For example, the comma appears to break up the word Share. Not that I understand the code at all, but I would have expected something like Mode = Share Deny Write, *NOT* Mode = Sha.re Deny Write. Is this format sacred? Tony On Tuesday, February 24, 2015 at 7:16:31 AM UTC-8, Paul Schreiner wrote: > There are many, many (many) ways of retrieving data from a database. > > What YOUR code: > Workbooks.OpenDatabase Filename:= _ > "G:\Work Program\2015\Temp.accdb", > > is doing is actually opening the actual database in Excel, instead of > retrieving the data. > > Instead, you could try: > On a blank sheet (with any name you like) > go to the Data tab, and select "From Access". > Select your accessdb. > > This should walk you through accessing specific tables within the AccessDb. > > > *Paul* > ----------------------------------------- > > > > > > > > *“Do all the good you can,By all the means you can,In all the ways you > can,In all the places you can,At all the times you can,To all the people > you can,As long as ever you can.” - John Wesley* > ----------------------------------------- > > *From:* "tony.k...@seattle.gov <javascript:>" <tony.k...@seattle.gov > <javascript:>> > *To:* excel-...@googlegroups.com <javascript:> > *Sent:* Monday, February 23, 2015 6:28 PM > *Subject:* $$Excel-Macros$$ Importing data from Access changes worksheet > name > > Hi all, > I'm pulling data from an Access DB query table. When I do, it changes the > name of the active worksheet and I don't want that. How to I pull the data > but keep the tab name as it was? Here's the code I'm using: > > ChDir "G:\Work Program\2015" > Workbooks.OpenDatabase Filename:= _ > "G:\Work Program\2015\Temp.accdb", CommandText:=Array( _ > "qry_TimesheetData"), CommandType:=xlCmdTable, > ImportDataAs:=xlTable > > Running Excel 2010 under Win7 > > Thanks > (BTW, if there's a clever way to get the data from the DB I'm all for it.) > > Tony > -- > Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s > =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ > https://www.facebook.com/discussexcel > > FORUM RULES > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > 2) Don't post a question in the thread of another member. > 3) Don't post questions regarding breaking or bypassing any security > measure. > 4) Acknowledge the responses you receive, good or bad. > 5) Jobs posting is not allowed. > 6) Sharing copyrighted material and their links is not allowed. > > NOTE : Don't ever post confidential data in a workbook. Forum owners and > members are not responsible for any loss. > --- > You received this message because you are subscribed to the Google Groups > "MS EXCEL AND VBA MACROS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to excel-macros...@googlegroups.com <javascript:>. > To post to this group, send email to excel-...@googlegroups.com > <javascript:>. > Visit this group at http://groups.google.com/group/excel-macros. > For more options, visit https://groups.google.com/d/optout. > > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.