Hi again,
In my previous thread regarding Combo box at runtime I had not forseen the problems I would experience introducing a variable to the code.
Private Sub Form_Load()
Set myconn = New ADODB.Connection
myconn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Gareth Powell\Desktop\db2.mdb"
myconn.Open
Set mycomm = New ADODB.Command
Set mycomm.ActiveConnection = myconn
mycomm.CommandType = adCmdText
mycomm.CommandText = "SELECT " & Text1.Text & " FROM table1"
Set myRS = mycomm.Execute
Do Until myRS.EOF = True
Combo1.AddItem myRS!Text1.Text
myRS.MoveNext
Loop
Set myRS = Nothing
Set mycomm = Nothing
Set myconn = Nothing
End Sub
Can someody tell me if and how I can introduce a variable in the line :-
Combo1.AddItem myRS!Text1.Text
which in the current format throws up a compile error.
Thanks again:confused: