Combo Box Choice to Two Other Boxes

M

Maurita

I have a combo box where the user chooses either "Production" or
"Downtime", which choice then places the cursor in an appropriate box
on the form. The code works fine until I try to have the "Production"
choice place the cursor in another field as well as place the words
"Production" in another box.

This following code works after choosing "Production", but does not put
the cursor in the Combo97 field.

If Me!Combo82 = Production" Then
Me.Combo28.Value = PROD"
ElseIf Me!ProdorDown = "Downtime" Then
DoCmd.GoToControl "Combo28"
End If

The following code does not work. I've tried various combinations to
get Combo 82 to put the word production in Combo 28 (which it does) and
also place the cursor in Combo 97 (where the problem lies), but nothing
works. The following is my latest attempt at the code. What am I
missing?

If Me!Combo82 = Production" _
& IIF (Combo97 <> strEmpty) _
Then DoCmd.GoToControl "Combo97" & Me.Combo28Value = "PROD"
ElseIf Me!ProdorDown = "Downtime" Then
DoCmd.GoToControl "Combo28"
End If


Thank you.

Maurita Searcy
 
G

Guest

Maurita

I hope I followed what you are trying to do. Try this:

If Me!Combo82 = "Production" Then
Me.Combo28.Value = "PROD" 'Change the value of Combo28
Me.Combo97.Setfocus 'Move cursor to Combo97
ElseIf Me!ProdorDown = "Downtime" Then
Me.Combo28.SetFocus 'Goto Combo28
End If

Whatch out for your quotations.

Daniel
 
M

Maurita

Daniel, thank you so very much, your code worked perfectly. I tried so many combinations, but I was trying to make it harder than it should have been. Again, thank you.

Maurita
 

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