Re: Go to Control with IIf statement
- From: "Al Campagna" <alcampagna@msnewsgroups>
- Date: Thu, 22 Mar 2007 15:35:38 -0400
Adriana,
When you say "the macro runs" make sure to indicate what it "did", rather than just
"ran".
Does it always go to ApprovedPMSNo?
There is a problem with your expression...
If cboCategory = "SHL" Or cboCategory = "COV" Then
MsgBox "Must fill in Approved Pantone Number", vbOKOnly
Me.ApprovedPMSNo.SetFocus
Else
Me.Supplier.SetFocus
End If
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions
"Find a job that you love, and you'll never work a day in your life."
"Adriana" <Adriana@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CC5418E5-5571-45EA-B8FB-D031151C0D5A@xxxxxxxxxxxxxxxx
It still doesn't work. Let me explain further. I have a category table with
three fields: ID (autonumber), category with abbreviated letters such as SHL
and COV (primary key set to this), and a description of the categories. In
another table that the form is based on, I have this combo box as a field set
to number property with a select statement (bound column is one). I only
want the focus to be set to field "ApprovedPMSNo" if category SHL or COV is
chosen with the message box popping up, otherwise the focus goes to the next
field which is "Supplier" (the normal tab order). This is what I put in the
After Update of my combo box and even if I pick other categories, the macro
runs.
If cboCategory = "SHL" Or "COV" Then
MsgBox "Must fill in Approved Pantone Number", vbOKOnly
Me.ApprovedPMSNo.SetFocus
Else
Me.Supplier.SetFocus
End If
"Al Campagna" wrote:
Adriana,
It woulkd have been helpful had you given a bit more detail, like the name of the
combo, the values in the combo, the names of the fields you want to go to, and what
selection goes to what field, and your Macro actions.
I never use macros... but I don't think Macros has an IFF action, so that's a
problem
to start with.
Use an Event Procedure that triggers on the AfterUpdate event of your combo (ex.
cboSomeChoice)
(use your own object names)
Private Sub cboSomeChoice_AfterUpdate()
If cboSomeChoice = "X" Then
MsgBox "Must fill in Field1", vbOKOnly
Me.Field1.SetFocus
Else
MsgBox "Must fill in Field2", vbOKOnly
Me.Field2.SetFocus
End If
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions
"Find a job that you love, and you'll never work a day in your life."
"Adriana" <Adriana@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CE743852-ECA1-4C1F-9D47-02DE43345932@xxxxxxxxxxxxxxxx
I would like to have a condition on a form control that will set the focus to
another control on the form. I have a drop down box in a form based on a
Category table and if that selection is one of two choices, then I need a
message box to tell them to fill in another control and a GoTo control to set
the focus to the other field. So far, I built a macro and assigned the macro
to the After Update event of the actual control. It works, however, no
matter which category is picked, the MsgBox pops up and sets focus to the
other field even though I only want two specific categories.
.
- Follow-Ups:
- Re: Go to Control with IIf statement
- From: Adriana
- Re: Go to Control with IIf statement
- References:
- Re: Go to Control with IIf statement
- From: Al Campagna
- Re: Go to Control with IIf statement
- Prev by Date: Re: Goto Control
- Next by Date: Re: Solved
- Previous by thread: Re: Go to Control with IIf statement
- Next by thread: Re: Go to Control with IIf statement
- Index(es):
Relevant Pages
|
|