Results 1 to 20 of 20

Thread: [RESOLVED] DataCombo/MySQL

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    [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:
    1. Do While Not rs.EOF
    2. DateUpdate.AddItem rs(0)
    3. rs.MoveNext
    4. Loop
    5.  
    6. Do While Not rs.EOF
    7. TimeUpdate.AddItem rs(0)
    8. rs.MoveNext
    9. 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:
    1. Private Sub Form_Load()
    2. Dim SQL As String
    3. Dim conn As ADODB.Connection
    4. Set conn = New ADODB.Connection
    5.  
    6. Dim rs As ADODB.Recordset
    7. Set rs = New ADODB.Recordset
    8.  
    9. conn.CursorLocation = adUseClient
    10. conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    11.   & "SERVER=00.00.000.000;" _
    12.   & "DATABASE=paddy_mbrblog;" _
    13.   & "UID=paddy_mbrblog;" _
    14.   & "PWD=mbrblog;" _
    15.   & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
    16.  
    17. conn.Open conn.ConnectionString
    18. SQL = "SELECT * FROM blog WHERE Username = '" & txtUpdateEntryUsername & "'"
    19.  
    20. Do While Not rs.EOF
    21. DateUpdate.AddItem rs(0)
    22. rs.MoveNext
    23. Loop
    24.  
    25. Do While Not rs.EOF
    26. TimeUpdate.AddItem rs(0)
    27. rs.MoveNext
    28. Loop
    29.  
    30. rs.Open SQL, conn, adOpenStatic, adLockReadOnly
    31.  
    32. rs.Close
    33.     Set rs = Nothing
    34.  
    35. conn.Close
    36.     Set conn = Nothing
    37. End Sub

    Please advise if you can. (DataMember property does not have anything in it and doesnt allow me to add anything either)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width