By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

multiple procedures under 1 event

P: 2
Hi I am new to VBA. I am trying to use an onEvent to trigger multiple independent procedures. How do you code it so the each sub procedures fires independently of the other procedures?
Mar 28 '12 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Are you talking about multi-threading? Meaning running different code at the same time? VBA does not have that kind of functionality. Just run them sequentially.
Mar 28 '12 #2

P: 2
No. It really is a simple question.

I have:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Combo87 = "Closed" Then
  3. Me.Text85.Enabled = True
  4. Else
  5. End If
  6. End Sub
and I need to add the code
Expand|Select|Wrap|Line Numbers
  1. If PostImpReview = "No" Then
  2. Me.PostImpReviewDate = Null
  3. Me.PostImpReviewDate.Enabled = False
  4. Else
  5. Me.PostImpReviewDate.Enabled = True
  6. Me.PostImpReviewDate.SetFocus
  7. End If
so both actions occur - so it 2 procedures under the 1 event.

Thank you inadvance of you inparting your wisdom on me.
Mar 28 '12 #3

mshmyob
Expert 100+
P: 903
Move your end sub to the end.

cheers,
Mar 28 '12 #4

NeoPa
Expert Mod 15k+
P: 31,494
Nevertheless, the simple question doesn't yet make sense.

Guessing what you might mean I would suggest (but frankly the question should make sense before the first post and not - maybe - after the third.) :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     With Me
  3.         .Text85.Enabled = (.Combo87 = "Closed")
  4.         With .PostImpReviewDate
  5.             If Me.PostImpReview = "No" Then
  6.                 .Value = Null
  7.                 .Enabled = False
  8.             Else
  9.                 .Enabled = True
  10.                 Call .SetFocus
  11.             End If
  12.         End With
  13.     End With
  14. End Sub
Mar 28 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.