[RESOLVED] DataCombo/MySQL
Hi Guys. I have a form that can successfully access a MySQL database. I have two DataCombo's on this form. They are both set up in the same way but to access a different column in the database.
The first DataCombo has a name called DateUpdate. The datasource has a value of Adodc1 (also has the control or what ever you all it on the form). The DataField is set to the column I want. The DataFormat is set to the format I want. However, when I run the form, ONLY the first entry in the database is placed into the DataCombo, nothing after that. The test database has two entries for testing. The second entry does not go in.
This is the same for the other DataCombo on the form. Of course, each DataCombo has a different name. And is set in the same way but to access a different column.
But when I added the following, the form doesn't come up, just shows the error message below and then the app closes
VB Code:
Do While Not rs.EOF
DateUpdate.AddItem rs(0)
rs.MoveNext
Loop
Do While Not rs.EOF
TimeUpdate.AddItem rs(0)
rs.MoveNext
Loop
Which I found on a thread in here a moment ago and was given the following error message:
Compile error:
Method or data memeber not found.
.AddItem for the first Do While was highlighted.
The complete sub is:
VB Code:
Private Sub Form_Load()
Dim SQL As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.CursorLocation = adUseClient
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=00.00.000.000;" _
& "DATABASE=paddy_mbrblog;" _
& "UID=paddy_mbrblog;" _
& "PWD=mbrblog;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
conn.Open conn.ConnectionString
SQL = "SELECT * FROM blog WHERE Username = '" & txtUpdateEntryUsername & "'"
Do While Not rs.EOF
DateUpdate.AddItem rs(0)
rs.MoveNext
Loop
Do While Not rs.EOF
TimeUpdate.AddItem rs(0)
rs.MoveNext
Loop
rs.Open SQL, conn, adOpenStatic, adLockReadOnly
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
End Sub
Please advise if you can. (DataMember property does not have anything in it and doesnt allow me to add anything either)