Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy Forums > > >

Solved: Question about running two events at once (visual basic)


(!)

eduardo12's Avatar
Member with 11 posts.
THREAD STARTER
 
Join Date: Jul 2012
06-Jul-2012, 11:30 PM #1
Solved: Question about running two events at once (visual basic)
Hi there, I need your help: I imitated another's database code to run a query to detect X situation while you open a form. If there are results a warning pops up.

So I made it a bit more complex, I've built three queries that detect three different situations on my database, all good so far. They work.

Now I need to developt the On Open Event Procedure so that the three queries run independently, and, if results for any of them, the pop up messages appear.

What I accomplished works ONLY if there are results for ALL OF THE QUERIES. But if there are no results for the first one, the other queries are not checked.

I hope I'm clear, I need to make the "on open" code independent for every query.

I hope I was clear

Thanks!

OBP's Avatar
OBP OBP is offline OBP is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 17,768 posts.
 
Join Date: Mar 2005
Location: UK
07-Jul-2012, 06:40 AM #2
You should not be using the Exit Sub within the first 2 If/Then statements as if it doesn't meet the requirement the code just stops and doesn't check the do the other tests, you can use
Exit If
if you want.
Rollin_Again's Avatar
Member with 4,530 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Advanced
07-Jul-2012, 07:56 AM #3
I would put the query itself in it's own procedure and then call it from another subroutine. Then all you have to do is use a loop to call the procedure three times passing it the appropriate arguments each time.

Rollin
eduardo12's Avatar
Member with 11 posts.
THREAD STARTER
 
Join Date: Jul 2012
07-Jul-2012, 11:09 AM #4
I don't have the skills to do it more sophisticated than this, but OBP's suggestion worked; now all queries are checked despite their individual results.

Thank you guys!
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑