Adding new user to Access database not working

Im having a problem when adding a new user to my Access database. For some reason it is saying that 'action cancelled by an associated object' and debugging at 'data1.recordset.update'. I have looked through the code and cannot figure it out. Any help would be much apreciated. Heres the code:


If Text1.Text = "" Or Text3.Text = "" Then
            MSG = "Please enter Username, employee type and password of new user"    ' Define message.
            Style = vbExclamation                      ' Define buttons.
            Title = "Enter details"                 ' Define title.
            responce = MsgBox(MSG, Style, Title)
            Text1.SetFocus
            'Data1.Recordset.MoveFirst
            cmdOk.Enabled = False
            Command7.Enabled = True
            Command1.Enabled = False
            Command2.Enabled = False
       
        ElseIf Text4.Text = Text3.Text Then
                Data1.Recordset.Update
                Data1.Refresh
                MsgBox ("User added")
                cmdOk.Enabled = False
                Text4.Text = ""
                Text1.Locked = True
                Text2.Locked = True
                Text3.Locked = True
                Text4.Locked = True
            Else
                MsgBox ("Confirmed password incorrect. Please confirm again")
                Text3.Text = ""
                Text4.Text = ""
                Text3.SetFocus
                Command1.Enabled = False
                Command2.Enabled = False
    End If

Thanks
matt_fennellAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Where do you put the recordset into ADDNEW mode?

mlmcc
0
bhagyeshtCommented:
have u written Data1.Recordset.AddNew ?
0
matt_fennellAuthor Commented:
Yes. That piece of code is in a seperate command button. I have an add command, then the necessary data is added. But when you click cmdok, where the update is stored, it gives me the error msg.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

mlmccCommented:
Are the controls bound?  Are you storing the passwords in clear text?

mlmcc
0
matt_fennellAuthor Commented:
Data control is bound. And text uses a '*' for password char
0
mlmccCommented:
I just ran into something similar today while building an application to update an MS SQL table.

I don't recall the exact error message but it was similar.  The problem was one of the fields I was updating was too short for the data I was trying to insert. I updated the field definition to be long enough and the problem went away.

Verify the password or username or employee type isn't too long.  Also verify you aren't trying to insert a NULL into a nonnullable field.

Password in the clear?
I was referring to in the database not on the screen?

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bhagyeshtCommented:
just check for access table properties for the field/s you are editing and check if your value matches with the constraints?
0
matt_fennellAuthor Commented:
Ok, I sorted out the problem on one screen, where my username was a particularly long one and was not accepted in Access as I set the constraint to 15 characters. I will look into what I can do for the check box. Thanks
0
mlmccCommented:
What check box?

mlmcc
0
matt_fennellAuthor Commented:
I had a similar problem when clicking an unclicking a text box, but I simply just refreshed the data instead of trying to edit it and then update.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.