Hi there can somebody tell how can will i be able to shorten my code: coz i think the code that i have is very redundant, can someone help me with this, i just want to do it in a single for loop.
Here's my code:
i hope someone hav an idea on this, thank you in advance.
Here's my code:
Code:
'Time Connection
If rs.State = adStateOpen Then rs.Close
rs.Open "Select * from [Time]", cnn, adOpenKeyset, adLockOptimistic
While rs.EOF <> True
For x = 0 To 11
frmMain.Combo1(x).AddItem rs.Fields("Time").Value
Next x
rs.MoveNext
Wend
'Time Connection
'Room Connection
If rs.State = adStateOpen Then rs.Close
rs.Open "Select * from [ROOMS]", cnn, adOpenKeyset, adLockOptimistic
While rs.EOF <> True
For x = 0 To 11
frmMain.Combo2(x).AddItem rs.Fields("ROOM").Value
Next x
rs.MoveNext
Wend
'Room Connection
'Days Connection
If rs.State = adStateOpen Then rs.Close
rs.Open "Select * from [DAYS]", cnn, adOpenKeyset, adLockOptimistic
While rs.EOF <> True
For x = 0 To 11
Form2.Combo3(x).AddItem rs.Fields("DAYS").Value
Next x
rs.MoveNext
Wend
'Days Connection
Comment