Re: Go to Control with IIf statement



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.


.



Relevant Pages

  • RE: Form calculation based on the date - How to????
    ... Access can't find the macro 'txtTotalDollarAmount_Bound = ... "Could it be that the control source for the form's field is now no longer ... txtTotalDollarAmount or txtTotalDollarAmount_Bound ... ... date field and then run the correct macro calculation based on that date. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Go to Control with IIf statement
    ... MsgBox "Must fill in Approved Pantone Number", ... After Update of my combo box and even if I pick other categories, the macro ... "Al Campagna" wrote: ... another control on the form. ...
    (microsoft.public.access.formscoding)
  • Re: Cant run macro containing for each
    ... first control in the document but I do as I click away from the others. ... Dim objCCs As ContentControls ... Private Sub Document_ContentControlOnEnter ... I went to the macros button and selected the only macro showing there ...
    (microsoft.public.word.vba.general)
  • RE: Macro Not Working
    ... So, the control, FieldA, isn't causing the macro to run because it isn't ... How is the value for FieldA calculated? ... So now something causes a calculation that causes a new value for FieldA. ...
    (microsoft.public.access.forms)
  • Re: Implementing a Macro Language
    ... Examples include the macro systems in Word and other ... the ones I thought that looked easy do not use automation. ... List control? ... which is an abstract automation interface. ...
    (microsoft.public.vc.mfc)

Loading