RE: User Form Cmd Button in Excel to run Access macro by FSt1
FSt1
Tue Jul 22 17:04:01 CDT 2008
hi
yes it is. but.....
I think that, from excel, you would be better off using MSQ(MicroSoftQuery)
than trying to do it the other way round.
here's the code
dim dbs as database
dim wrkjet as workspace
fname = "filename of database plus full path"
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbs = wrkJet.OpenDatabase(fname, True)
sql = "copy code from your query builder in Access"
dbs.execute sql
dbs.close
I got this code from access newgroups. i do not know the author and
apoligize for not being able to name the author. i used it once then went
back to MSQ. seems stupid to write a query in access then write a query in
excel to run the access query. skip the access query-do the MSQ. less code.
less typing. quicker??? opions vary i hear.
my thoughts
regards
FSt1
"D" wrote:
> I have a mdb that has a macro that transfers query results to excel. I would
> like to use a UserForm in excel VB for a user to click a command button and
> run the macro that is in Access. Is this possible and if so, what would the
> code look like.