Conditional Next Form

C

Chip Melton

Hi, I am realitively new to ACCESS but i am trying to build a form that
holds the General Data (i.e. Name Address and Rank) but i need a button
(which I have created)that will send the person to another Form (Form 1) if
the person puts in a Combo box answer of '1' in the "Rank" Field and
another Form (Form 2) if the "Rank" field is populated with a '2' and still
another form (Form 3) if the rank is '3'. I just cannot seem to get
anything to work. It is probably simple VB but I am very new at that also.
I am thinking it would be a "IIF" statement but everything i have attempted
says "Illogical Error" so that must not be right!!!

Any help would be greatly Appreciated!!!!
Oh, and thanks in advance!!!!
 
J

John Vinson

Hi, I am realitively new to ACCESS but i am trying to build a form that
holds the General Data (i.e. Name Address and Rank) but i need a button
(which I have created)that will send the person to another Form (Form 1) if
the person puts in a Combo box answer of '1' in the "Rank" Field and
another Form (Form 2) if the "Rank" field is populated with a '2' and still
another form (Form 3) if the rank is '3'. I just cannot seem to get
anything to work. It is probably simple VB but I am very new at that also.
I am thinking it would be a "IIF" statement but everything i have attempted
says "Illogical Error" so that must not be right!!!

Any help would be greatly Appreciated!!!!
Oh, and thanks in advance!!!!

You'ld probably need code something like this, in the AfterUpdate
event of the combo box:

Private Sub cboRank_AfterUpdate()
Select Case Me!cboRank
Case 1
DoCmd.OpenForm "Form 1", <parameters>
Case 2
DoCmd.OpenForm "Form 2", <parameters>
<etc>
Case Else
<put out an error message about unexpected selection>
End Select
End Sub
 
J

John Vinson

Hi, I am realitively new to ACCESS but i am trying to build a form that
holds the General Data (i.e. Name Address and Rank) but i need a button
(which I have created)that will send the person to another Form (Form 1) if
the person puts in a Combo box answer of '1' in the "Rank" Field and
another Form (Form 2) if the "Rank" field is populated with a '2' and still
another form (Form 3) if the rank is '3'. I just cannot seem to get
anything to work. It is probably simple VB but I am very new at that also.
I am thinking it would be a "IIF" statement but everything i have attempted
says "Illogical Error" so that must not be right!!!

Any help would be greatly Appreciated!!!!
Oh, and thanks in advance!!!!

You'ld probably need code something like this, in the AfterUpdate
event of the combo box:

Private Sub cboRank_AfterUpdate()
Select Case Me!cboRank
Case 1
DoCmd.OpenForm "Form 1", <parameters>
Case 2
DoCmd.OpenForm "Form 2", <parameters>
<etc>
Case Else
<put out an error message about unexpected selection>
End Select
End Sub
 

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