Please help me..What is wrong with this syntax...there are 2 parts of error..

Private Sub class_initialize()
    DoEvents
    Set con = New ADODB.Connection
    With con
        .ConnectionString = "Driver=(MySQL ODBC 3.51 Driver);SERVER=localhost;PWD=;UID=root;PORT=3306;DATABASe=cvsur;"
        .CursorLocation = adUseClient
        .Open
    End With
End Sub

.Open was the error from this syntax..(Sytax Above)

______________________________________________________________

And another one is this..

Private Sub cmdSave_Click()
    Set rs = New ADODB.Recordset
    rs.Open "select * from  tbl_account", con, 3, 3

    With rs
        '.AddNew
        .Fields("fname") = fname.Text
        .Fields("mname") = mname.Text
        .Fields("lname") = lname.Text
        .Fields("idnum") = idnum.Text
        .Fields("acode") = acode.Text
        .Fields("password") = password.Text
        .Fields("gend") = gend.Text
        .Fields("contact") = contact.Text
        .Fields("address") = address.Text
        .Update            
    End With

    MsgBox "New Data has been saved!"
    fname.Text = ""
    mname.Text = ""
    lname.Text = ""
    idnum.Text = ""
    acode.Text = ""
    password.Text = ""
    gend.Text = ""
    contact.Text = ""
    address.Text = ""

    Set rs = Nothing

End Sub

The error from this syntax is on this line rs.Open "select * from tbl_account", con, 3, 3

Recommended Answers

All 2 Replies

Please post the exact error message text. Also, check your connection string. You are using parentheses instead of curly brackets. Example

"Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase;   User=myUsername;Password=myPassword;Option=3;"

Thank you very much sir...It works!..:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.