different choices different questions

F

f_ringberg

I have a form in access which i have put a box with 4 choices to choose
between. Then I have a command button.
Now I want to:
if selecting choice1 and pressing the command button it should open
question1
if selecting choice2 and pressing the command button it should open
question2
if selecting choice3 and pressing the command button it should open
question3
if selecting choice4 and pressing the command button it should open
question4

based on choice different question is opened

i succeed open a question (always the same) when pressing the command
button but where in the command box can I scan with choice is marked??
 
R

Ron2005

research case in the help system

select case me.choicetxtbox
case choice1
open question 1
case choice2
open question 2
etc.......
end select
 
F

f_ringberg

I dont' succeed. Down you can se the code
(etikett3 is name on the control box)


Private Sub Kommandoknapp22_Click()
On Error GoTo Err_Kommandoknapp22_Click

Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stDocName4 As String

stDocName1 = "fråga vårdgivare"
stDocName2 = "fråga ort"
stDocName3 = "fråga län"
stDocName4 = "fråga specialitet"

Select Case Etikett3
Case 1
DoCmd.OpenQuery stDocName1, acNormal, acEdit
Case 2
DoCmd.OpenQuery stDocName2, acNormal, acEdit
Case 3
DoCmd.OpenQuery stDocName3, acNormal, acEdit
Case 4
DoCmd.OpenQuery stDocName4, acNormal, acEdit
End Select

Exit_Kommandoknapp22_Click:
 
R

RoyVidar

(e-mail address removed) wrote in message
I dont' succeed. Down you can se the code
(etikett3 is name on the control box)


Private Sub Kommandoknapp22_Click()
On Error GoTo Err_Kommandoknapp22_Click

Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stDocName4 As String

stDocName1 = "fråga vårdgivare"
stDocName2 = "fråga ort"
stDocName3 = "fråga län"
stDocName4 = "fråga specialitet"

Select Case Etikett3
Case 1
DoCmd.OpenQuery stDocName1, acNormal, acEdit
Case 2
DoCmd.OpenQuery stDocName2, acNormal, acEdit
Case 3
DoCmd.OpenQuery stDocName3, acNormal, acEdit
Case 4
DoCmd.OpenQuery stDocName4, acNormal, acEdit
End Select

Exit_Kommandoknapp22_Click:

One question - "Etikett" means "Label" - are you sure your option group
is really called "Etikett3" - or is this posssibly the name of the
assosiated label? Just to be sure, try selecting the whole option group
and check if that is really the name.

Also - could we please have a more descriptive explanation - for
instance whether or not there's an error, and if so, which error, and
which line it bombs on (comment the "on error ..." line if so, which
will make it stop/highlight that line.
 

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