Solved

Adding new user to Access database not working

Posted on 2003-11-12
10
311 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
 
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to setup 18 79
factorial example challenge 10 61
Sorting in Excel with Group Headers if the Exist 2 68
wordappend challenge 8 84
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This is an explanation of a simple data model to help parse a JSON feed
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now