Move to next control using Select Case

G

Guest

Need a little help here.


Using A2K, I have a combo box on a form that contains a list of about 20
"tasks" than can be selected on some of the tasks I am having a detail form
open up, depending on which one is selected. For example, If I select New
Contract from the combo box my "Contract Selection" should open up but it
doesn't. Instead it is going to the Case Else at the end of my select
statement, which moves the user to the next field if they select one of the
items that does not need a detail form filled out. Can someone tell me why
my select case is not working?

My select case statement is as follows:

Private Sub Job_Type_AfterUpdate()
Select Case Form_Tbl_Master_Jobs!Job_Type
Case "New Contract"
DoCmd.OpenForm Contract_Selection 'Opens form to select either Bio
or Int.
Case "Rental"
DoCmd.OpenForm frm_Rental_Detail, acNormal, Qry_Rental_Detail,
"Me!Rental_Acct_No = Frm_Tbl_Master_Jobs", acFormAdd
Case "Evaluation"
DoCmd.OpenForm frm_Eval_Detail, acNormal, Qry_Eval_Detail,
"Me!Eval_Detail_Act_No = Frm_Tbl_Master_Jobs", acFormAdd
Case Else
DoCmd.GoToControl "Rep_name"

End Select
End Sub

Thank you,
 
G

Guest

Hi, Emma.

Assuming that Job_Type is the name of your combo box, then the column that
displays these values (i.e., "New Contract," "Rental," et cetera) is not the
bound column of the combo box. Use the values in the bound colum for this
select case statement, unless you want to use the Column(#) Property instead.
If this is the case, then try:

Select Case Me!Job_Type.Column(1)

.. . . where Job_Type is the name of the combo box, and the displayed column
is the second column, and the combo box is on the current form. If it's not
on the current form, then try:

Select Case Form_Tbl_Master_Jobs!Job_Type.Column(1)

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 

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