Avatar of dave_sing
dave_sing

asked on 

I want to launch a VB module in Access 2007 via a marco

I want to launch a VB module in Access 2007 via a marco. the marco would start a VB module and when the module completed its work, the marco would provide a message and execute 2 queries then another VB module. thanks
Microsoft ApplicationsMicrosoft Access

Avatar of undefined
Last Comment
ROM
SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
I would add that I find it better to use  VBA procedure to do this. This way you can use sub's , error handling that a macro does not provide.

Avatar of dave_sing
dave_sing

ASKER

I'll give it a try tomorrow. on my way home from work.
thanks
SOLUTION
Avatar of ROM
ROM
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
dave_sing

The problem with your logic is that it assumes that code will complete successfully.
What if it doesn't?

My guess is that if the code fails for some reason, you do not want to then run the queries.
I will also presume that you would like to inform the user of this.

For these reasons I would also recommend using VBA, not Macros for this.

My suggestion?
Create a function that determines if the code ran successfully.
Based on the result of this function, you would either notify the user that the code failed and exit the code (not running the queries)
Or (if the code did run successfully), simply go on to run the queries...

JeffCoachman
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of dave_sing
dave_sing

ASKER

thank yo to all for providing me with multiple solutions and rationale for using each method.
Avatar of ROM
ROM
Flag of United Kingdom of Great Britain and Northern Ireland image

Your Welcome :)

R
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo