open a form from selected item of combo box

  • Thread starter Thread starter reservedbcreater
  • Start date Start date
R

reservedbcreater

i want to select a value from my combo box and have it open the form
corresponding to that value.....ie combo box has 7 values....each is a
reserve(indian settlement) name, each reserve has its own form. so i pick
one of the reserves from the drop down combo box and then click the go
button i created, and its supposed to open the correct form............

here is my psuedo code for the go button click event:

if cbo.selecteditem = sweet grass then
docmd.openform sweet grass

elseif cbo.selecteditem = little pine then
docmd.openform little pine

etc..

end if
 
reservedbcreater said:
i want to select a value from my combo box and have it open the form
corresponding to that value.....ie combo box has 7 values....each is a
reserve(indian settlement) name, each reserve has its own form. so i pick
one of the reserves from the drop down combo box and then click the go
button i created, and its supposed to open the correct form............

here is my psuedo code for the go button click event:

if cbo.selecteditem = sweet grass then
docmd.openform sweet grass

elseif cbo.selecteditem = little pine then
docmd.openform little pine

etc..

end if

You can just place
If Not IsNull(cbo) Then DoCmd.OpenForm cbo

in your button's click event. This is assuming "cbo" is the name of your
combo control and the values are the names of your forms.

HTH
Steve C
 
ur recomendation didnt work? is ther esomeway to do it using my way?

here is my psuedo code for the go button click event:

if cbo.selecteditem = sweet grass then
docmd.openform sweet grass

elseif cbo.selecteditem = little pine then
docmd.openform little pine

etc..

end if

(im used to VB.Net)
 
first of all i dunno what the name of my combo box is? how do i name
it.......also....the combo box selection are jsut the reserve names...the
forsm have sligthy different names. ie Sweet Grass: Water
 
in design mode, right click the combo box then click
properties. the name will be at the top. it will probably
be something like combobox1. you can rename it. I usually
rename all my controls to a name like what goes in them.
like a text box for name become txtname. i usually start
combobox name with cb. renameing control like this
sometimes makes it easier later when you aare writing code.
 
Back
Top