Using string variable

A

Art Vandaley

Hi,

I have a code like below:

Private Sub Combo0_BeforeUpdate(Cancel As Integer)

Dim A As String
A = Combo0.Value
Combo2.RowSourceType = "TABLE/QUERY"
Combo2.RowSource = "SELECT" & A & "FROM TABLE1" --> not working

End Sub

Combo0 is showing field name list of table1.
"A" is getting current field name of table1 according to combo0's selection.
I want combo2 to change its list according what "A"is.
How can I write the code after "combo2.rowsource="

Thanks a lot for help.
 
D

Dennis

I think all you need is spaces, but if the field name can have spaces, it
might be better and safer like this
Combo2.RowSource = "SELECT [" & A & "] FROM TABLE1"
 

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