Results 1 to 10 of 10

Thread: New User : VB6 Project : Database Problem

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Unhappy New User : VB6 Project : Database Problem

    Hi

    I am a newbie to VB6.. Ive read many helps and all and i am trying to make a Access DB driven Project.. Here is a simple code for adding some form info to the database..

    VB Code:
    1. Private Sub cmdadduser_Click()
    2.  
    3. 'Checking for no field to be empty
    4.  
    5. If txtid.Text = vbNullString Or txtpassword.Text = vbNullString Or _
    6. txtname.Text = vbNullString Or txtaddress.Text = vbNullString _
    7. Or txtemail.Text = vbNullString Or txtphone.Text = vbNullString Then
    8.  
    9. MsgBox "All Fields Must Contain Data", vbCritical, "Error"
    10.  
    11.  
    12.  
    13. Else
    14.  
    15.  
    16. 'Adding the Record
    17.  
    18.   rs.AddNew
    19.   rs("ebay_id") = txtid.Text
    20.   rs("password") = txtpassword.Text
    21.   rs("name") = txtname.Text
    22.   rs("address") = txtaddress.Text
    23.   rs("email") = txtemail.Text
    24.   rs("phone") = txtphone.Text
    25.   rs.Update
    26.  
    27. MsgBox "You for Registering Please Login Now", vbOKOnly, "Successful"
    28.  
    29.  
    30. Unload frmnewuser
    31. frmwelcome.Show
    32. End If
    33.  
    34. End Sub
    35.  
    36. Private Sub cmdreset_Click()
    37.  
    38. ' Reseting All textboxes
    39.  
    40. txtid.Text = ""
    41. txtname.Text = ""
    42. txtpassword.Text = ""
    43. txtaddress.Text = ""
    44. txtemail.Text = ""
    45. txtphone.Text = ""
    46. txtid.SetFocus
    47.  
    48. End Sub
    49.  
    50. Private Sub cmdreturn_Click()
    51.  
    52. Unload Me
    53. frmwelcome.Show
    54.  
    55. End Sub
    56.  
    57. Private Sub Form_Load()
    58.  
    59. Dim db As Database
    60. Dim rs As Recordset
    61. Dim ws As Workspace
    62.  
    63. Set ws = DBEngine.Workspaces(0)
    64. Set db = ws.OpenDatabase(App.Path & "\db.mdb")
    65. Set rs = db.OpenRecordset("user_info", dbOpenTable)
    66.  
    67. End Sub

    According to me everything is fine.. But when i run the program.. I get the following error

    424 : Object required

    on line

    VB Code:
    1. rs.addnew

    Please tell me what Am i doing wrong and what is to be corrected?? Maybe my connection is not right??
    Last edited by khandu; Dec 17th, 2006 at 02:46 PM.

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