hi there can anyone tell me wats wrong with my program, its a like this i have a database called "dbTimescheduli ng", with a field with a name of "Time",,, for now i want to do is to be able to access the "Time" field in my program it must be displayed in a combo box array.. can someone help me out on this.. heres my code:
The error is in this area of my code:
i hope someone can figure wats wrong with my code. am getting a error of
"Syntax error FROM clause"... thank you in advance
Code:
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim db As New ADODB.Connection
Dim cnn As New ADODB.Connection
Set db = New ADODB.Connection
cnn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\dbTimeScheduling.mdb;"
cnn.Open
Set rs = New ADODB.Recordset
rs.Open "Select * from Time;", cnn, adOpenKeyset, adLockOptimistic
'Courses
cboCourse.AddItem "B.S. AERONAUTICAL ENGINEERING"
cboCourse.AddItem "B.S. AIR TRANSPORTATION"
cboCourse.AddItem "B.S. AIR MAINTENANCE TECHNOLOGY"
cboCourse.AddItem "B.S. AVIONICS TECHNOOGY"
cboCourse.AddItem "B.S. TOURISM"
cboCourse.AddItem "B.S. AIRLINE BUSINESS ADMINISTRATION"
cboCourse.AddItem "B.S. AIRLINE OFFICE ADMINISTRATION"
cboCourse.AddItem "B.S. HOTEL & RESTAURANT MANAGEMENT"
cboCourse.AddItem "AIRCRAFT TECHNICIAN"
'Semester
cboSemester.AddItem "1st Semester"
cboSemester.AddItem "2nd Semester"
cboSemester.AddItem "Summer"
'Time
If rs.State = adStateOpen Then rs.Close
rs.Open "Select Time from Time", db, adOpenDynamic, adLockOptimistic
For x = 1 To 15
While rs.EOF <> True
Combo1(x).AddItem rs.Fields(Time).Value
rs.MoveNext
Wend
Next x
If Combo1(x).ListCount > 0 Then Combo1(x).ListIndex = 0
End Sub
Code:
Set rs = New ADODB.Recordset rs.Open "Select * from Time;", cnn, adOpenKeyset, adLockOptimistic
"Syntax error FROM clause"... thank you in advance
Comment