Macro Help!

O

Omar

First, thanks for reading this note, I appreciate it.

Im trying to put together a macro using visual basic under
the event procedure that allows the selection of Audit or
Surv under a combo box located in the main form that shift
focus on one of two subforms using the tab control tool.
The name of the tabs are Audit and Surveillance while the
name in the combo box are audit and Surv, respectively. I
get a "Sub or Function Not Defined" error. Can someone
help please, thank you.

Private Sub Activity_Type_AfterUpdate()
Condition: Activity_Type = Audit
Action: GoToControl
ControlName: Audit

Condition: Activity_Type = Surv
Action: GoToControl
ControlName: Surveillance
 
O

Omar

Thank You STEVE.. You answered my question..
-----Original Message-----
Omar,

You have got confused between macros and VBA procedures.

If you want to do this with a macro, you need to design it in the
macro window of your database, save it, and then enter the name of the
macro into the AfterUpdate event property in your form design. In
this case, you would put...
[Activity_Type]="Audit"
.... in the Condition column of your macro design window (Select
Conditions from the View menu if you can't currently see a Condition
column), you would enter GoToControl in the Action column, and you
would enter [Audit] in the Control Name argument box. And the same
pattern for the Surv.

If you are using a VBA event procedure, it will look something like
this...
Private Sub Activity_Type_AfterUpdate()
Select Case Me.Activity_Type
Case "Audit"
Me.Audit.SetFocus
Case "Surv"
Me.Surveillance.SetFocus
End Select
End Sub

- Steve Schapel, Microsoft Access MVP
 

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

Top