-
Apr 17th, 2006, 04:47 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED]Error when updating database
I'm using ADO commands, VB 6.0, and MS Office 2000
Below is the code I am using to update my database. I'm testing a single field first so it's just one line of code.
VB Code:
With Form2.rs
.AddNew
.Fields("fldEmpGender") = cmbGender.Text
.Update
End With
When I do this I get the an error saying...
Run-time error '-bunch of numbers':
The field 'tblEmployee.fldEmpPassword' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field.
I don't get this error. My test database only has 3 employees in it and they all have passwords already entered in the fldEmpPassword table/database.
After I hit 'OK' it highlights the .Update line in yellow.
Last edited by lilmark; Apr 20th, 2006 at 04:45 PM.
-
Apr 17th, 2006, 05:31 PM
#2
Re: Error when updating database
You tried to add a new Employee Record but did not specify the password. As the error states the password is required and cannot be Null.
-
Apr 17th, 2006, 05:35 PM
#3
Thread Starter
Hyperactive Member
Re: Error when updating database
Originally Posted by brucevde
You tried to add a new Employee Record but did not specify the password. As the error states the password is required and cannot be Null.
I hate the obvious.
I was trying to edit a current record. I didn't mean to add a new one.
To edit I would only to delete the .addnew from my current coding, right? Or is there some edit coding I need to include?
-
Apr 17th, 2006, 05:57 PM
#4
Re: Error when updating database
You were right, for ADO nothing is needed - an edit is implied as soon as you set/change values.
(for DAO you need to specify an edit)
-
Apr 19th, 2006, 10:15 PM
#5
Re: Error when updating database
Originally Posted by lilmark
I'm using ADO commands, VB 6.0, and MS Office 2000
Below is the code I am using to update my database. I'm testing a single field first so it's just one line of code.
VB Code:
With Form2.rs
.AddNew
.Fields("fldEmpGender") = cmbGender.Text
.Update
End With
When I do this I get the an error saying...
I don't get this error. My test database only has 3 employees in it and they all have passwords already entered in the fldEmpPassword table/database.
After I hit 'OK' it highlights the .Update line in yellow.
Remove the .AddNew if you only want to update...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|