Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Run time error 424, object required

Posted on 2006-06-15
4
Medium Priority
?
425 Views
Last Modified: 2010-08-05
I am receving Run time Error 424 in this code
Private Sub cmdAdd_Click()
    txtPassword.Enabled = True
    txtCPassword.Enabled = True
 Open_conn
    Set rs = New ADODB.Recordset
        rs.Open "select * from login", conn, adOpenDynamic, adLockOptimistic
   
Dim samepassword As Boolean
   
    If txtPassword.Text = txtCPassword.Text Then
        samepassword = True
    Else
        samepassword = False
        MsgBox "The passwords do not match", , "Login"
        txtCPassword.SetFocus
        Exit Sub
    End If
    rs.MoveLast
    rs.AddNew
    rs.Fields("userid") = Trim(txtUserName.Text)       <------------ERROR Place
    rs.Fields("pwd") = Trim(txtPassword.Text)
    rs.Fields("cpwd") = Trim(txtCPassword.Text)
    rs.Update
   
    MsgBox "Username and password added"
    txtUserName.Text = ""
    txtPassword.Text = ""
    txtCPassword.Text = ""
    txtUserName.SetFocus
Close_conn
End Sub
0
Comment
Question by:xpsavy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 750 total points
ID: 16911382
what are the fields of the login table?


    rs.Fields("userid").Value = Trim(txtUserName.Text)       <------------ERROR Place
    rs.Fields("pwd").Value = Trim(txtPassword.Text)
    rs.Fields("cpwd").Value = Trim(txtCPassword.Text)
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16916883
...Is the maximum length (in characters) of the "userid" column in the [login] table being exceeded by the character length of the text in txtUserName.Text?

Is "UserId" a text (string) field in the table?  Or is it a numeric (long?) data type?

Thanks for your clarification.

BFN,

fp.
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 16918029
It should be one of these two.

Either the table doesnot contain the field "userid", or the form doesnot contain the control "txtUserName".

Check if both are spelled correctly.

Otherwise, give rs("userid") instead of rs.fields("userid")
0
 
LVL 1

Expert Comment

by:lalitgada
ID: 16974966
Check out for the field name userid. whether the field name you are using is correct or not and also check the text box name of txtUserName whether it is te same as that given during desidn time.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question