0

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

Edited by Reverend Jim: fixed code formatting

2
Contributors
2
Replies
9
Views
3 Years
Discussion Span
Last Post by yAjMeL
0

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;"

Edited by Reverend Jim

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.