syncronising combo boxes

T

Ticotion

Hi

I'm trying to syncronising two combo boxes. I'm using the following code:

Private Sub Tekst44_AfterUpdate()

' Update the row source of the combo box 64
' when the user makes a selection in the tekst44
' combo box.

Me.combobox64.RowSource = "SELECT tbSIM.code FROM" & _
" tbSIMl WHERE tbSIMl.exp= " & Me.Tekst44 & _
" ORDER BY tbSIMl.code"

Me.combobox64 = Me.combobox64.ItemData(0)
End Sub

In Tekst44 there the user can choose different types of respondsabilities
(eg. Production, Technical etc.). And in combobox64 I want the code connected
to this respndsability to be written. My problem is that there should be " "
around Tekst44 other wise I get prompted by the responsability the user has
chosen in Tekst44. How do you do that in the above?

regards

Ticotion
 
A

Andrew Tapp

Try using either a single quote;
"tbSIMl WHERE tbSIMl.exp= '" & Me.Tekst44 & "' ORDER BY tbSIMl.code"

or two double quotes;
"tbSIMl WHERE tbSIMl.exp= "" & Me.Tekst44 & "" ORDER BY tbSIMl.code"

or the chr$ function;
"tbSIMl WHERE tbSIMl.exp= " & Chr$(34) & Me.Tekst44 & Chr$(34) & " ORDER BY
tbSIMl.code"

My personal preference is normally to use a single quote.

Hope this helps.
 
A

Andrew Tapp

Two double quotes should be three;
"tbSIMl WHERE tbSIMl.exp= """ & Me.Tekst44 & """ ORDER BY tbSIMl.code"
 
T

Ticotion

thank you that works

ticotion

Andrew Tapp said:
Two double quotes should be three;
"tbSIMl WHERE tbSIMl.exp= """ & Me.Tekst44 & """ ORDER BY tbSIMl.code"
 

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