Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

synchronize two combo boxes on a form

Status
Not open for further replies.

edgarchado

Technical User
Apr 5, 2005
59
AR
Hi to all,

I have two como boxes. The first combo box which it's source is a list with two values (1 and 2) determines what information will show up in the second combo box.

I am using this code in the afterupdate event of the fist combo box to acomplish this:

Private Sub Formato_AfterUpdate()
Me.Sensibilidad.RowSource = "SELECT sensibilidad FROM" & _
" Productos WHERE formato = " & Me.Formato
Me.Sensibilidad = Me.Sensibilidad.ItemData(0)
End Sub

The problem that I am having is with the & Me.Formato portion of the code.

When selecting the first combo box. The source data of the second box turns into (when selecting 1 in the first):

SELECT sensibilidad FROM Productos WHERE formato = 1

The problem is that for the select to work I need the 1 to be between Quotation Marks ("1").

How can I add this in the & Me.Formato section of the first combo so that they apear in the second one.

I hope my question is clear.

Thank you.
 
Just put them in your code
Code:
Me.Sensibilidad.RowSource = "SELECT sensibilidad FROM" & _
   " Productos WHERE formato = [COLOR=red]'[/color]" & Me.Formato [COLOR=red]& "'"[/color]

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
traingamer,

Thank you for your quick answer. That was what I needed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top