Solved

Adding new user to Access database not working

Posted on 2003-11-12
10
332 Views
Last Modified: 2010-04-17
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
0
Comment
Question by:matt_fennell
  • 4
  • 4
  • 2
10 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9736997
Where do you put the recordset into ADDNEW mode?

mlmcc
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9738974
have u written Data1.Recordset.AddNew ?
0
 

Author Comment

by:matt_fennell
ID: 9764899
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 100

Expert Comment

by:mlmcc
ID: 9771132
Are the controls bound?  Are you storing the passwords in clear text?

mlmcc
0
 

Author Comment

by:matt_fennell
ID: 9771524
Data control is bound. And text uses a '*' for password char
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 20 total points
ID: 9775632
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
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9776260
just check for access table properties for the field/s you are editing and check if your value matches with the constraints?
0
 

Author Comment

by:matt_fennell
ID: 9777028
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 9784072
What check box?

mlmcc
0
 

Author Comment

by:matt_fennell
ID: 9785558
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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 95
Microsoft C++ code failing in executable that worked 9 97
recursion example 16 124
Help Required 3 92
A short article about problems I had with the new location API and permissions in Marshmallow
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

785 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