Call Access Macro from VB

  • Thread starter Thread starter ITC
  • Start date Start date
I

ITC

From VB 6.0 Is there a way to call a macro in Access without using a
reference to Access Object Library?

May be through a API call? If so can somebody give me some sample code?

Thanks,
ITC
 
Hi.
From VB 6.0 Is there a way to call a macro in Access without using a
reference to Access Object Library?

Yes. However, it requires that Microsoft Access be installed. Shell out to
DOS (or use a Windows shortcut's Target Property) to call the database
application's macro with the following syntax (should be all one line):

"C:\Program Files\Microsoft Office\OFFICE11\MSAccess.exe" "C:\MyDB.mdb" /x
MacroName

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
Hi

Run macro once
DoCmd.RunMacro "Macro1", , ""

Run macro 27 times
DoCmd.RunMacro "Macro1", 27, ""

Run macro 16 time OR until the the expression = False
DoCmd.RunMacro "Macro1", 16, "[Forms]![ClientDetails]![1stName]=""Wayne"""
 
Hi, Wayne.

The DoCmd class is a member of the Microsoft Access Object Library, which
the OP wants to avoid setting a reference to in VB.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Wayne-I-M said:
Hi

Run macro once
DoCmd.RunMacro "Macro1", , ""

Run macro 27 times
DoCmd.RunMacro "Macro1", 27, ""

Run macro 16 time OR until the the expression = False
DoCmd.RunMacro "Macro1", 16, "[Forms]![ClientDetails]![1stName]=""Wayne"""


--
Wayne
Manchester, England.



ITC said:
From VB 6.0 Is there a way to call a macro in Access without using a
reference to Access Object Library?

May be through a API call? If so can somebody give me some sample code?

Thanks,
ITC
 
Hi

Yes I know - sorry about that - should read the posts better before
answering.

Can I add that to my long list of new year's resolutions :-) or do I have
to wait until next January 1st for that.

--
Wayne
Manchester, England.



'69 Camaro said:
Hi, Wayne.

The DoCmd class is a member of the Microsoft Access Object Library, which
the OP wants to avoid setting a reference to in VB.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Wayne-I-M said:
Hi

Run macro once
DoCmd.RunMacro "Macro1", , ""

Run macro 27 times
DoCmd.RunMacro "Macro1", 27, ""

Run macro 16 time OR until the the expression = False
DoCmd.RunMacro "Macro1", 16, "[Forms]![ClientDetails]![1stName]=""Wayne"""


--
Wayne
Manchester, England.



ITC said:
From VB 6.0 Is there a way to call a macro in Access without using a
reference to Access Object Library?

May be through a API call? If so can somebody give me some sample code?

Thanks,
ITC
 
Hi, Wayne.
Can I add that to my long list of new year's resolutions :-) or do I have
to wait until next January 1st for that.

Sorry. Any new new year's resolutions will apply on January 1st, 2008.
However, recycled new year's resolutions can be applied at any time during
any subsequent year (such as the ones to put more into savings accounts, to
not insult the mother-in-law within hearing distance, et cetera).

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Wayne-I-M said:
Hi

Yes I know - sorry about that - should read the posts better before
answering.

Can I add that to my long list of new year's resolutions :-) or do I have
to wait until next January 1st for that.

--
Wayne
Manchester, England.



'69 Camaro said:
Hi, Wayne.

The DoCmd class is a member of the Microsoft Access Object Library, which
the OP wants to avoid setting a reference to in VB.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Wayne-I-M said:
Hi

Run macro once
DoCmd.RunMacro "Macro1", , ""

Run macro 27 times
DoCmd.RunMacro "Macro1", 27, ""

Run macro 16 time OR until the the expression = False
DoCmd.RunMacro "Macro1", 16,
"[Forms]![ClientDetails]![1stName]=""Wayne"""


--
Wayne
Manchester, England.



:

From VB 6.0 Is there a way to call a macro in Access without using a
reference to Access Object Library?

May be through a API call? If so can somebody give me some sample
code?

Thanks,
ITC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top