open a form if user inputs specific text

  • Thread starter Thread starter fishqqq
  • Start date Start date
F

fishqqq

My form has a combo box which lets the user choose between 2 options.
I would like a specific form to open up if the user chooses one of the
options specifically.


if [Combo223]="haz" then open [forms]![fShpSpec]![fHazmatInfo]

I was thinking of running this as an "after update" macro on
[Combo223] but am not certain how to format it correctly?

any suggestions are greatly appreciated.
 
My form has a combo box which lets the user choose between 2 options.
I would like a specific form to open up if the user chooses one of the
options specifically.


if [Combo223]="haz" then open [forms]![fShpSpec]![fHazmatInfo]

I was thinking of running this as an "after update" macro on
[Combo223] but am not certain how to format it correctly?

any suggestions are greatly appreciated.

I'd suggest using VBA code rather than a Macro, and allowing for more than two
choices. In the AfterUpdate property put [Event Procedure] and code like

Private Sub Combo223_AfterUpdate()
Select Case Me!Combo223
Case "Haz"
DoCmd.OpenForm "fShpSpec" ' assuming that's the name of the form you
want to open - what is fHazmatInfo?????
Case "Innocuous"
DoCmd.OpenForm "fSomeOtherForm"
Case Else
MsgBox "Invalid selection"
End Select
End Sub
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
My form has a combo box which lets the user choose between 2 options.
I would like a specific form to open up if the user chooses one of the
options specifically.
if [Combo223]="haz" then open [forms]![fShpSpec]![fHazmatInfo]
I was thinking of running this as an "after update" macro on
[Combo223] but am not certain how to format it correctly?
any suggestions are greatly appreciated.

I'd suggest using VBA code rather than a Macro, and allowing for more than two
choices. In the AfterUpdate property put [Event Procedure] and code like

Private Sub Combo223_AfterUpdate()
Select Case Me!Combo223
  Case "Haz"
     DoCmd.OpenForm "fShpSpec"   ' assuming that's the name of the form you
want to open - what is fHazmatInfo?????
  Case "Innocuous"
     DoCmd.OpenForm "fSomeOtherForm"
  Case Else
     MsgBox "Invalid selection"
End Select
End Sub
--

             John W. Vinson [MVP]
 Microsoft's replacements for these newsgroups:
 http://social.msdn.microsoft.com/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

thanks John, this worked well. I actually gave the wrong information.
The correct form to open was fHazmatinfo (which basically asks the
user what the hazardous details are of this item.
thanks again.
Steve
 
Back
Top