i am a freshman IT student and im making a citizen records database for my thesis... i would like to ask help from you guys with my codings, ms access relationships and errors.

errors:
empty row cannot be inserted.


access relationships:
how do i make a one-to-many relationship with enforce referential integrity so that when i have a record in tblCitizens(main table), i would have the tblmother and tblfather and tblsibling1-5 connected to it.... please help URGENT ^_^

Recommended Answers

All 46 Replies

inserting from where ?

using what to insert ?

inserting into what ?

im inserting from VB6

im using adodc1.recordset.fields("(fieldname)") = txt1.text

and im inserting to a ms access database

Yes , exactly all that info you should have passed on in the 1st post of the thread.


empty row cannot be inserted.

the error message is self explanatory in nature.

Yes , exactly all that info you should have passed on in the 1st thread.


empty row cannot be inserted.

the error message is self explanatory in nature.

well, im an absolute beginner at vb6....

so i dnt know how to fix it...

It seems that you are trying to add a new record to your table, but there is nothing (no data) to add. You need to show us what code you have used to execute the INSERT statement.

It seems that you are trying to add a new record to your table, but there is nothing (no data) to add. You need to show us what code you have used to execute the INSERT statement.

well here's the code... im not quite sure as to what exactly u meant so i gave the whole code.

btw. i used design time connection

Dim adoconn As New ADODB.Connection
Dim rs As New ADODB.Recordset



Private Sub cmdaddprof_Click()
        
        Adodc2.Recordset.AddNew

        Adodc3.Recordset.AddNew

        Adodc4.Recordset.AddNew

        Adodc5.Recordset.AddNew

        Adodc6.Recordset.AddNew
        
        Adodc7.Recordset.AddNew
        
        Adodc8.Recordset.AddNew
        
        Adodc9.Recordset.AddNew
        





End Sub






Private Sub cmddelprof_Click()
confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If confirm = vbYes Then
Adodc2.Recordset.Delete
Adodc3.Recordset.Delete
Adodc4.Recordset.Delete
Adodc5.Recordset.Delete
Adodc6.Recordset.Delete
Adodc7.Recordset.Delete
Adodc8.Recordset.Delete
Adodc9.Recordset.Delete

Adodc2.Recordset.Update
Adodc3.Recordset.Update
Adodc4.Recordset.Update
Adodc5.Recordset.Update
Adodc6.Recordset.Update
Adodc7.Recordset.Update
Adodc8.Recordset.Update
Adodc9.Recordset.Update


    MsgBox "Record Deleted.", , "Message"
Else
    MsgBox "Record Not Deleted.", , "Message"
End If
    Books.Refresh
End Sub

Private Sub cmdsaveprof_Click()

'for tblCitizen
With Adodc2.Recordset
    Adodc2.Recordset.Save
    Adodc2.Recordset.Fields("Name") = txtname.Text
    Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm-dd-yy")
    Adodc2.Recordset.Fields("Age") = txtage.Text
    Adodc2.Recordset.Fields("Gender") = txtgender.Text
    Adodc2.Recordset.Fields("Social Status") = txtstatus.Text
    Adodc2.Recordset.Fields("Nationality") = txtnationality.Text
    Adodc2.Recordset.Fields("Address") = txtaddress.Text
    Adodc2.Recordset.Fields("Religion") = txtreligion.Text
    Adodc2.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc2.Recordset.Fields("Telephone No") = txttel.Text
    Adodc2.Recordset.Fields("Cellphone No") = txtcell.Text
    Adodc2.Recordset.Fields("Occupation") = txtocc.Text
    Adodc2.Recordset.Fields("Educational Attainment") = txteduc.Text
    Adodc2.Recordset.Fields("Course taken") = txtcourse.Text
    Adodc2.Recordset.Fields("School") = txtschool.Text
    Adodc2.Recordset.Update
    Adodc2.Refresh
End With

'for tblFather
With Adodc3.Recordset
    Adodc3.Recordset.Save
    Adodc3.Recordset.Fields("Name") = txtfaname.Text
    Adodc3.Recordset.Fields("Occupation") = txtfaocc.Text
    Adodc3.Recordset.Fields("Age") = txtfaage.Text
    Adodc3.Recordset.Fields("Nationality") = txtfanationality.Text
    Adodc3.Recordset.Fields("Religion") = txtfareligion.Text
    Adodc3.Recordset.Fields("Birthdate") = Format(txtfabirth.Text, "MM-dd-yyyy")
    Adodc3.Recordset.Fields("Telephone") = txtfatell.Text
    Adodc3.Recordset.Fields("Cellphone") = txtfacell.Text
    Adodc3.Recordset.Fields("Educational Attainment") = txtfaeduc.Text
    Adodc3.Recordset.Fields("Course") = txtfacourse.Text
    Adodc3.Recordset.Fields("School") = txtfaschool.Text
    Adodc3.Recordset.Update
    Adodc3.Refresh
End With

'for tblMother
With Adodc4.Recordset
    Adodc4.Recordset.Save
    Adodc4.Recordset.Fields("Name") = txtmoname.Text
    Adodc4.Recordset.Fields("Occupation") = txtmoocc.Text
    Adodc4.Recordset.Fields("Age") = txtmoage.Text
    Adodc4.Recordset.Fields("Nationality") = txtmonationality.Text
    Adodc4.Recordset.Fields("Religion") = txtmoreligion.Text
    Adodc4.Recordset.Fields("Birthdate") = Format(txtmobirth.Text, "MM-dd-yyyy")
    Adodc4.Recordset.Fields("Telephone") = txtmotel.Text
    Adodc4.Recordset.Fields("Cellphone") = txtmocell.Text
    Adodc4.Recordset.Fields("Educational Attainment") = txtmoeduc.Text
    Adodc4.Recordset.Fields("Course") = txtmocourse.Text
    Adodc4.Recordset.Fields("School") = txtmoschool.Text
    Adodc4.Recordset.Update
    Adodc4.Refresh
End With

'for tblSibling1
With Adodc5.Recordset
    Adodc5.Recordset.Save
    Adodc5.Recordset.Fields("Name") = txtsibling1.Text
    Adodc5.Recordset.Fields("Age") = txtage1.Text
    Adodc5.Recordset.Fields("Birthdate") = Format(txtbirth1.Text, "MM-dd-yyyy")
    Adodc5.Recordset.Update
    Adodc5.Refresh
End With

'for tblSibling2
With Adodc6.Recordset
    Adodc6.Recordset.Save
    Adodc6.Recordset.Fields("Name") = txtsibling2.Text
    Adodc6.Recordset.Fields("Age") = txtage2.Text
    Adodc6.Recordset.Fields("Birthdate") = Format(txtbirth2.Text, "MM-dd-yyyy")
    Adodc6.Recordset.Update
    Adodc6.Refresh
End With


'for tblSibling3
With Adodc7.Recordset
    Adodc7.Recordset.Save
    Adodc7.Recordset.Fields("Name") = txtsibling3.Text
    Adodc7.Recordset.Fields("Age") = txtage3.Text
    Adodc7.Recordset.Fields("Birthdate") = Format(txtbirth3.Text, "MM-dd-yyyy")
    Adodc7.Recordset.Update
    Adodc7.Refresh
End With

'for tblSibling4
With Adodc8.Recordset
    Adodc8.Recordset.Save
    Adodc8.Recordset.Fields("Name") = txtsibling4.Text
    Adodc8.Recordset.Fields("Age") = txtage4.Text
    Adodc8.Recordset.Fields("Birthdate") = Format(txtbirth4.Text, "MM-dd-yyyy")
    Adodc8.Recordset.Update
    Adodc8.Refresh
End With

'for tblSibling5
With Adodc9.Recordset
    Adodc9.Recordset.Save
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "MM-dd-yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With










End Sub


Private Sub Form_Load()

End Sub

Private Sub mnuabout_Click()
    frmAbout.Show
End Sub

Private Sub mnucitprof_Click()
    frmmain.Show
End Sub

Private Sub mnuexit_Click()
    End
End Sub

Private Sub mnumanage_Click()
    frmmanage.Show
End Sub

Private Sub mnuprofile_Click()
    frmstudent.Show
End Sub

I think I found your problem. At every sub where you want to save the data, you were calling "Adodc2.Recordset.Save" the save event before adding the data. Rename all your "Adodc2.Recordset.Save" lines to "Adodc9.Recordset.AddNew.:)

With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "MM-dd-yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With

I think I found your problem. At every sub where you want to save the data, you were calling "Adodc2.Recordset.Save" the save event before adding the data. Rename all your "Adodc2.Recordset.Save" lines to "Adodc9.Recordset.AddNew.:)

With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "MM-dd-yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With

is this what youre asking me to do?

for tblCitizen
With Adodc2.Recordset
    Adodc2.Recordset.AddNew
    Adodc2.Recordset.Fields("Name") = txtname.Text
    Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm-dd-yy")
    Adodc2.Recordset.Fields("Age") = txtage.Text
    Adodc2.Recordset.Fields("Gender") = txtgender.Text
    Adodc2.Recordset.Fields("Social Status") = txtstatus.Text
    Adodc2.Recordset.Fields("Nationality") = txtnationality.Text
    Adodc2.Recordset.Fields("Address") = txtaddress.Text
    Adodc2.Recordset.Fields("Religion") = txtreligion.Text
    Adodc2.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc2.Recordset.Fields("Telephone No") = txttel.Text
    Adodc2.Recordset.Fields("Cellphone No") = txtcell.Text
    Adodc2.Recordset.Fields("Occupation") = txtocc.Text
    Adodc2.Recordset.Fields("Educational Attainment") = txteduc.Text
    Adodc2.Recordset.Fields("Course taken") = txtcourse.Text
    Adodc2.Recordset.Fields("School") = txtschool.Text
    Adodc2.Recordset.Update
    Adodc2.Refresh
End With

'for tblFather
With Adodc3.Recordset
    Adodc3.Recordset.AddNew
    Adodc3.Recordset.Fields("Name") = txtfaname.Text
    Adodc3.Recordset.Fields("Occupation") = txtfaocc.Text
    Adodc3.Recordset.Fields("Age") = txtfaage.Text
    Adodc3.Recordset.Fields("Nationality") = txtfanationality.Text
    Adodc3.Recordset.Fields("Religion") = txtfareligion.Text
    Adodc3.Recordset.Fields("Birthdate") = Format(txtfabirth.Text, "MM-dd-yyyy")
    Adodc3.Recordset.Fields("Telephone") = txtfatell.Text
    Adodc3.Recordset.Fields("Cellphone") = txtfacell.Text
    Adodc3.Recordset.Fields("Educational Attainment") = txtfaeduc.Text
    Adodc3.Recordset.Fields("Course") = txtfacourse.Text
    Adodc3.Recordset.Fields("School") = txtfaschool.Text
    Adodc3.Recordset.Update
    Adodc3.Refresh
End With

'for tblMother
With Adodc4.Recordset
    Adodc4.Recordset.AddNew
    Adodc4.Recordset.Fields("Name") = txtmoname.Text
    Adodc4.Recordset.Fields("Occupation") = txtmoocc.Text
    Adodc4.Recordset.Fields("Age") = txtmoage.Text
    Adodc4.Recordset.Fields("Nationality") = txtmonationality.Text
    Adodc4.Recordset.Fields("Religion") = txtmoreligion.Text
    Adodc4.Recordset.Fields("Birthdate") = Format(txtmobirth.Text, "MM-dd-yyyy")
    Adodc4.Recordset.Fields("Telephone") = txtmotel.Text
    Adodc4.Recordset.Fields("Cellphone") = txtmocell.Text
    Adodc4.Recordset.Fields("Educational Attainment") = txtmoeduc.Text
    Adodc4.Recordset.Fields("Course") = txtmocourse.Text
    Adodc4.Recordset.Fields("School") = txtmoschool.Text
    Adodc4.Recordset.Update
    Adodc4.Refresh
End With

'for tblSibling1
With Adodc5.Recordset
    Adodc5.Recordset.AddNew
    Adodc5.Recordset.Fields("Name") = txtsibling1.Text
    Adodc5.Recordset.Fields("Age") = txtage1.Text
    Adodc5.Recordset.Fields("Birthdate") = Format(txtbirth1.Text, "MM-dd-yyyy")
    Adodc5.Recordset.Update
    Adodc5.Refresh
End With

'for tblSibling2
With Adodc6.Recordset
    Adodc6.Recordset.AddNew
    Adodc6.Recordset.Fields("Name") = txtsibling2.Text
    Adodc6.Recordset.Fields("Age") = txtage2.Text
    Adodc6.Recordset.Fields("Birthdate") = Format(txtbirth2.Text, "MM-dd-yyyy")
    Adodc6.Recordset.Update
    Adodc6.Refresh
End With


'for tblSibling3
With Adodc7.Recordset
    Adodc7.Recordset.AddNew
    Adodc7.Recordset.Fields("Name") = txtsibling3.Text
    Adodc7.Recordset.Fields("Age") = txtage3.Text
    Adodc7.Recordset.Fields("Birthdate") = Format(txtbirth3.Text, "MM-dd-yyyy")
    Adodc7.Recordset.Update
    Adodc7.Refresh
End With

'for tblSibling4
With Adodc8.Recordset
    Adodc8.Recordset.AddNew
    Adodc8.Recordset.Fields("Name") = txtsibling4.Text
    Adodc8.Recordset.Fields("Age") = txtage4.Text
    Adodc8.Recordset.Fields("Birthdate") = Format(txtbirth4.Text, "MM-dd-yyyy")
    Adodc8.Recordset.Update
    Adodc8.Refresh
End With

'for tblSibling5
With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "MM-dd-yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With










End Sub

Yes.

That should work for you.

Yes.

well another error occured.... "multi-step operation generated errors. check each status value"

it occured in the code

Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm-dd-yy")

check if you are trying to put a string into a VARCHAR field that is too long.

To your previous code, yes.

To this post error, the date returned from your format function is not the same as the date your database table will accept. Ensure that the formats is the same, i.e. your format will return 03-11-2011 whilst the database will only accept 2011/03/11. Change this and you should be fine.:)

Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "yyyy/mm/dd")

Let me know how it went.

To your previous code, yes.

To this post error, the date returned from your format function is not the same as the date your database table will accept. Ensure that the formats is the same, i.e. your format will return 03-11-2011 whilst the database will only accept 2011/03/11. Change this and you should be fine.:)

Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "yyyy/mm/dd")

Let me know how it went.

sir... it's still the same... my date is for example:
1/25/1993 and my code is

adodc3.recordset.fields("Birthdate") = format(txtbirth.text, "mm-dd-yyyy")

What format does your database want. You can see this if you select the date field. See if the format expected is the same as the date you are trying to add.

Did you try my code/date format above?

What format does your database want. You can see this if you select the date field. See if the format expected is the same as the date you are trying to add.

Did you try my code/date format above?

well, no i didnt try the code above coz this is the format my database wants. im clueless as to what causes this error since the date in the textbox is exactly the same as the date in my database.

Are you using access as a database? Can you add a pic of the table with its fields with the Birthdate field selected?

Are you using access as a database? Can you add a pic of the table with its fields with the Birthdate field selected?

ok here's the pic

Got it. Your format is incorrect. The mm dd yyyy is correct, but you need slashes and not "-".:)

Adodc3.recordset.fields("Birthdate") = format(txtbirth.text, "mm/dd/yyyy")

Got it. Your format is incorrect. The mm dd yyyy is correct, but you need slashes and not "-".:)

Adodc3.recordset.fields("Birthdate") = format(txtbirth.text, "mm/dd/yyyy")

still didn't make any change.. T_T

Dim adoconn As New ADODB.Connection
Dim rs As New ADODB.Recordset



Private Sub cmdaddprof_Click()
        
        Adodc2.Recordset.AddNew

        Adodc3.Recordset.AddNew

        Adodc4.Recordset.AddNew

        Adodc5.Recordset.AddNew

        Adodc6.Recordset.AddNew
        
        Adodc7.Recordset.AddNew
        
        Adodc8.Recordset.AddNew
        
        Adodc9.Recordset.AddNew
        





End Sub






Private Sub cmddelprof_Click()
confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If confirm = vbYes Then
Adodc2.Recordset.Delete
Adodc3.Recordset.Delete
Adodc4.Recordset.Delete
Adodc5.Recordset.Delete
Adodc6.Recordset.Delete
Adodc7.Recordset.Delete
Adodc8.Recordset.Delete
Adodc9.Recordset.Delete

Adodc2.Recordset.Update
Adodc3.Recordset.Update
Adodc4.Recordset.Update
Adodc5.Recordset.Update
Adodc6.Recordset.Update
Adodc7.Recordset.Update
Adodc8.Recordset.Update
Adodc9.Recordset.Update


    MsgBox "Record Deleted.", , "Message"
Else
    MsgBox "Record Not Deleted.", , "Message"
End If
    Books.Refresh
End Sub

Private Sub cmdsaveprof_Click()

'for tblCitizen
With Adodc2.Recordset
    Adodc2.Recordset.AddNew
    Adodc2.Recordset.Fields("Name") = txtname.Text
    Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm/dd/yyyy")
    Adodc2.Recordset.Fields("Age") = txtage.Text
    Adodc2.Recordset.Fields("Gender") = txtgender.Text
    Adodc2.Recordset.Fields("Social Status") = txtstatus.Text
    Adodc2.Recordset.Fields("Nationality") = txtnationality.Text
    Adodc2.Recordset.Fields("Address") = txtaddress.Text
    Adodc2.Recordset.Fields("Religion") = txtreligion.Text
    Adodc2.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc2.Recordset.Fields("Telephone No") = txttel.Text
    Adodc2.Recordset.Fields("Cellphone No") = txtcell.Text
    Adodc2.Recordset.Fields("Occupation") = txtocc.Text
    Adodc2.Recordset.Fields("Educational Attainment") = txteduc.Text
    Adodc2.Recordset.Fields("Course taken") = txtcourse.Text
    Adodc2.Recordset.Fields("School") = txtschool.Text
    Adodc2.Recordset.Update
    Adodc2.Refresh
End With

'for tblFather
With Adodc3.Recordset
    Adodc3.Recordset.AddNew
    Adodc3.Recordset.Fields("Name") = txtfaname.Text
    Adodc3.Recordset.Fields("Occupation") = txtfaocc.Text
    Adodc3.Recordset.Fields("Age") = txtfaage.Text
    Adodc3.Recordset.Fields("Nationality") = txtfanationality.Text
    Adodc3.Recordset.Fields("Religion") = txtfareligion.Text
    Adodc3.Recordset.Fields("Birthdate") = Format(txtfabirth.Text, "mm/dd/yyyy")
    Adodc3.Recordset.Fields("Telephone") = txtfatell.Text
    Adodc3.Recordset.Fields("Cellphone") = txtfacell.Text
    Adodc3.Recordset.Fields("Educational Attainment") = txtfaeduc.Text
    Adodc3.Recordset.Fields("Course") = txtfacourse.Text
    Adodc3.Recordset.Fields("School") = txtfaschool.Text
    Adodc3.Recordset.Update
    Adodc3.Refresh
End With

'for tblMother
With Adodc4.Recordset
    Adodc4.Recordset.AddNew
    Adodc4.Recordset.Fields("Name") = txtmoname.Text
    Adodc4.Recordset.Fields("Occupation") = txtmoocc.Text
    Adodc4.Recordset.Fields("Age") = txtmoage.Text
    Adodc4.Recordset.Fields("Nationality") = txtmonationality.Text
    Adodc4.Recordset.Fields("Religion") = txtmoreligion.Text
    Adodc4.Recordset.Fields("Birthdate") = Format(txtmobirth.Text, "mm/dd/yyyy")
    Adodc4.Recordset.Fields("Telephone") = txtmotel.Text
    Adodc4.Recordset.Fields("Cellphone") = txtmocell.Text
    Adodc4.Recordset.Fields("Educational Attainment") = txtmoeduc.Text
    Adodc4.Recordset.Fields("Course") = txtmocourse.Text
    Adodc4.Recordset.Fields("School") = txtmoschool.Text
    Adodc4.Recordset.Update
    Adodc4.Refresh
End With

'for tblSibling1
With Adodc5.Recordset
    Adodc5.Recordset.AddNew
    Adodc5.Recordset.Fields("Name") = txtsibling1.Text
    Adodc5.Recordset.Fields("Age") = txtage1.Text
    Adodc5.Recordset.Fields("Birthdate") = Format(txtbirth1.Text, "mm/dd/yyyy")
    Adodc5.Recordset.Update
    Adodc5.Refresh
End With

'for tblSibling2
With Adodc6.Recordset
    Adodc6.Recordset.AddNew
    Adodc6.Recordset.Fields("Name") = txtsibling2.Text
    Adodc6.Recordset.Fields("Age") = txtage2.Text
    Adodc6.Recordset.Fields("Birthdate") = Format(txtbirth2.Text, "mm/dd/yyyy")
    Adodc6.Recordset.Update
    Adodc6.Refresh
End With


'for tblSibling3
With Adodc7.Recordset
    Adodc7.Recordset.AddNew
    Adodc7.Recordset.Fields("Name") = txtsibling3.Text
    Adodc7.Recordset.Fields("Age") = txtage3.Text
    Adodc7.Recordset.Fields("Birthdate") = Format(txtbirth3.Text, "mm/dd/yyyy")
    Adodc7.Recordset.Update
    Adodc7.Refresh
End With

'for tblSibling4
With Adodc8.Recordset
    Adodc8.Recordset.AddNew
    Adodc8.Recordset.Fields("Name") = txtsibling4.Text
    Adodc8.Recordset.Fields("Age") = txtage4.Text
    Adodc8.Recordset.Fields("Birthdate") = Format(txtbirth4.Text, "mm/dd/yyyy")
    Adodc8.Recordset.Update
    Adodc8.Refresh
End With

'for tblSibling5
With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "m/dd/yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With










End Sub


Private Sub mnuabout_Click()
    frmAbout.Show
End Sub

Private Sub mnucitprof_Click()
    frmmain.Show
End Sub

Private Sub mnuexit_Click()
    End
End Sub

Private Sub mnumanage_Click()
    frmmanage.Show
End Sub

Private Sub mnuprofile_Click()
    frmstudent.Show
End Sub

im gonna attach the project too for you to see it urself

i NEVER GIVE UP, BUT ITS CLOSE.;)

What value is returned from txtBirth1, 2, 3 etc. Is it a proper date as in the format?

Got it. Your format is incorrect. The mm dd yyyy is correct, but you need slashes and not "-".:)

Adodc3.recordset.fields("Birthdate") = format(txtbirth.text, "mm/dd/yyyy")

still didn't make any change.. T_T

Dim adoconn As New ADODB.Connection
Dim rs As New ADODB.Recordset



Private Sub cmdaddprof_Click()
        
        Adodc2.Recordset.AddNew

        Adodc3.Recordset.AddNew

        Adodc4.Recordset.AddNew

        Adodc5.Recordset.AddNew

        Adodc6.Recordset.AddNew
        
        Adodc7.Recordset.AddNew
        
        Adodc8.Recordset.AddNew
        
        Adodc9.Recordset.AddNew
        





End Sub






Private Sub cmddelprof_Click()
confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If confirm = vbYes Then
Adodc2.Recordset.Delete
Adodc3.Recordset.Delete
Adodc4.Recordset.Delete
Adodc5.Recordset.Delete
Adodc6.Recordset.Delete
Adodc7.Recordset.Delete
Adodc8.Recordset.Delete
Adodc9.Recordset.Delete

Adodc2.Recordset.Update
Adodc3.Recordset.Update
Adodc4.Recordset.Update
Adodc5.Recordset.Update
Adodc6.Recordset.Update
Adodc7.Recordset.Update
Adodc8.Recordset.Update
Adodc9.Recordset.Update


    MsgBox "Record Deleted.", , "Message"
Else
    MsgBox "Record Not Deleted.", , "Message"
End If
    Books.Refresh
End Sub

Private Sub cmdsaveprof_Click()

'for tblCitizen
With Adodc2.Recordset
    Adodc2.Recordset.AddNew
    Adodc2.Recordset.Fields("Name") = txtname.Text
    Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm/dd/yyyy")
    Adodc2.Recordset.Fields("Age") = txtage.Text
    Adodc2.Recordset.Fields("Gender") = txtgender.Text
    Adodc2.Recordset.Fields("Social Status") = txtstatus.Text
    Adodc2.Recordset.Fields("Nationality") = txtnationality.Text
    Adodc2.Recordset.Fields("Address") = txtaddress.Text
    Adodc2.Recordset.Fields("Religion") = txtreligion.Text
    Adodc2.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc2.Recordset.Fields("Telephone No") = txttel.Text
    Adodc2.Recordset.Fields("Cellphone No") = txtcell.Text
    Adodc2.Recordset.Fields("Occupation") = txtocc.Text
    Adodc2.Recordset.Fields("Educational Attainment") = txteduc.Text
    Adodc2.Recordset.Fields("Course taken") = txtcourse.Text
    Adodc2.Recordset.Fields("School") = txtschool.Text
    Adodc2.Recordset.Update
    Adodc2.Refresh
End With

'for tblFather
With Adodc3.Recordset
    Adodc3.Recordset.AddNew
    Adodc3.Recordset.Fields("Name") = txtfaname.Text
    Adodc3.Recordset.Fields("Occupation") = txtfaocc.Text
    Adodc3.Recordset.Fields("Age") = txtfaage.Text
    Adodc3.Recordset.Fields("Nationality") = txtfanationality.Text
    Adodc3.Recordset.Fields("Religion") = txtfareligion.Text
    Adodc3.Recordset.Fields("Birthdate") = Format(txtfabirth.Text, "mm/dd/yyyy")
    Adodc3.Recordset.Fields("Telephone") = txtfatell.Text
    Adodc3.Recordset.Fields("Cellphone") = txtfacell.Text
    Adodc3.Recordset.Fields("Educational Attainment") = txtfaeduc.Text
    Adodc3.Recordset.Fields("Course") = txtfacourse.Text
    Adodc3.Recordset.Fields("School") = txtfaschool.Text
    Adodc3.Recordset.Update
    Adodc3.Refresh
End With

'for tblMother
With Adodc4.Recordset
    Adodc4.Recordset.AddNew
    Adodc4.Recordset.Fields("Name") = txtmoname.Text
    Adodc4.Recordset.Fields("Occupation") = txtmoocc.Text
    Adodc4.Recordset.Fields("Age") = txtmoage.Text
    Adodc4.Recordset.Fields("Nationality") = txtmonationality.Text
    Adodc4.Recordset.Fields("Religion") = txtmoreligion.Text
    Adodc4.Recordset.Fields("Birthdate") = Format(txtmobirth.Text, "mm/dd/yyyy")
    Adodc4.Recordset.Fields("Telephone") = txtmotel.Text
    Adodc4.Recordset.Fields("Cellphone") = txtmocell.Text
    Adodc4.Recordset.Fields("Educational Attainment") = txtmoeduc.Text
    Adodc4.Recordset.Fields("Course") = txtmocourse.Text
    Adodc4.Recordset.Fields("School") = txtmoschool.Text
    Adodc4.Recordset.Update
    Adodc4.Refresh
End With

'for tblSibling1
With Adodc5.Recordset
    Adodc5.Recordset.AddNew
    Adodc5.Recordset.Fields("Name") = txtsibling1.Text
    Adodc5.Recordset.Fields("Age") = txtage1.Text
    Adodc5.Recordset.Fields("Birthdate") = Format(txtbirth1.Text, "mm/dd/yyyy")
    Adodc5.Recordset.Update
    Adodc5.Refresh
End With

'for tblSibling2
With Adodc6.Recordset
    Adodc6.Recordset.AddNew
    Adodc6.Recordset.Fields("Name") = txtsibling2.Text
    Adodc6.Recordset.Fields("Age") = txtage2.Text
    Adodc6.Recordset.Fields("Birthdate") = Format(txtbirth2.Text, "mm/dd/yyyy")
    Adodc6.Recordset.Update
    Adodc6.Refresh
End With


'for tblSibling3
With Adodc7.Recordset
    Adodc7.Recordset.AddNew
    Adodc7.Recordset.Fields("Name") = txtsibling3.Text
    Adodc7.Recordset.Fields("Age") = txtage3.Text
    Adodc7.Recordset.Fields("Birthdate") = Format(txtbirth3.Text, "mm/dd/yyyy")
    Adodc7.Recordset.Update
    Adodc7.Refresh
End With

'for tblSibling4
With Adodc8.Recordset
    Adodc8.Recordset.AddNew
    Adodc8.Recordset.Fields("Name") = txtsibling4.Text
    Adodc8.Recordset.Fields("Age") = txtage4.Text
    Adodc8.Recordset.Fields("Birthdate") = Format(txtbirth4.Text, "mm/dd/yyyy")
    Adodc8.Recordset.Update
    Adodc8.Refresh
End With

'for tblSibling5
With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "m/dd/yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With










End Sub


Private Sub mnuabout_Click()
    frmAbout.Show
End Sub

Private Sub mnucitprof_Click()
    frmmain.Show
End Sub

Private Sub mnuexit_Click()
    End
End Sub

Private Sub mnumanage_Click()
    frmmanage.Show
End Sub

Private Sub mnuprofile_Click()
    frmstudent.Show
End Sub

im gonna attach the project too for you to see it urself

Got it. Your format is incorrect. The mm dd yyyy is correct, but you need slashes and not "-".:)

Adodc3.recordset.fields("Birthdate") = format(txtbirth.text, "mm/dd/yyyy")

still didn't make any change.. T_T

Dim adoconn As New ADODB.Connection
Dim rs As New ADODB.Recordset



Private Sub cmdaddprof_Click()
        
        Adodc2.Recordset.AddNew

        Adodc3.Recordset.AddNew

        Adodc4.Recordset.AddNew

        Adodc5.Recordset.AddNew

        Adodc6.Recordset.AddNew
        
        Adodc7.Recordset.AddNew
        
        Adodc8.Recordset.AddNew
        
        Adodc9.Recordset.AddNew
        





End Sub






Private Sub cmddelprof_Click()
confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If confirm = vbYes Then
Adodc2.Recordset.Delete
Adodc3.Recordset.Delete
Adodc4.Recordset.Delete
Adodc5.Recordset.Delete
Adodc6.Recordset.Delete
Adodc7.Recordset.Delete
Adodc8.Recordset.Delete
Adodc9.Recordset.Delete

Adodc2.Recordset.Update
Adodc3.Recordset.Update
Adodc4.Recordset.Update
Adodc5.Recordset.Update
Adodc6.Recordset.Update
Adodc7.Recordset.Update
Adodc8.Recordset.Update
Adodc9.Recordset.Update


    MsgBox "Record Deleted.", , "Message"
Else
    MsgBox "Record Not Deleted.", , "Message"
End If
    Books.Refresh
End Sub

Private Sub cmdsaveprof_Click()

'for tblCitizen
With Adodc2.Recordset
    Adodc2.Recordset.AddNew
    Adodc2.Recordset.Fields("Name") = txtname.Text
    Adodc2.Recordset.Fields("Birthdate") = Format(txtbirth.Text, "mm/dd/yyyy")
    Adodc2.Recordset.Fields("Age") = txtage.Text
    Adodc2.Recordset.Fields("Gender") = txtgender.Text
    Adodc2.Recordset.Fields("Social Status") = txtstatus.Text
    Adodc2.Recordset.Fields("Nationality") = txtnationality.Text
    Adodc2.Recordset.Fields("Address") = txtaddress.Text
    Adodc2.Recordset.Fields("Religion") = txtreligion.Text
    Adodc2.Recordset.Fields("Birthdate") = txtbirth.Text
    Adodc2.Recordset.Fields("Telephone No") = txttel.Text
    Adodc2.Recordset.Fields("Cellphone No") = txtcell.Text
    Adodc2.Recordset.Fields("Occupation") = txtocc.Text
    Adodc2.Recordset.Fields("Educational Attainment") = txteduc.Text
    Adodc2.Recordset.Fields("Course taken") = txtcourse.Text
    Adodc2.Recordset.Fields("School") = txtschool.Text
    Adodc2.Recordset.Update
    Adodc2.Refresh
End With

'for tblFather
With Adodc3.Recordset
    Adodc3.Recordset.AddNew
    Adodc3.Recordset.Fields("Name") = txtfaname.Text
    Adodc3.Recordset.Fields("Occupation") = txtfaocc.Text
    Adodc3.Recordset.Fields("Age") = txtfaage.Text
    Adodc3.Recordset.Fields("Nationality") = txtfanationality.Text
    Adodc3.Recordset.Fields("Religion") = txtfareligion.Text
    Adodc3.Recordset.Fields("Birthdate") = Format(txtfabirth.Text, "mm/dd/yyyy")
    Adodc3.Recordset.Fields("Telephone") = txtfatell.Text
    Adodc3.Recordset.Fields("Cellphone") = txtfacell.Text
    Adodc3.Recordset.Fields("Educational Attainment") = txtfaeduc.Text
    Adodc3.Recordset.Fields("Course") = txtfacourse.Text
    Adodc3.Recordset.Fields("School") = txtfaschool.Text
    Adodc3.Recordset.Update
    Adodc3.Refresh
End With

'for tblMother
With Adodc4.Recordset
    Adodc4.Recordset.AddNew
    Adodc4.Recordset.Fields("Name") = txtmoname.Text
    Adodc4.Recordset.Fields("Occupation") = txtmoocc.Text
    Adodc4.Recordset.Fields("Age") = txtmoage.Text
    Adodc4.Recordset.Fields("Nationality") = txtmonationality.Text
    Adodc4.Recordset.Fields("Religion") = txtmoreligion.Text
    Adodc4.Recordset.Fields("Birthdate") = Format(txtmobirth.Text, "mm/dd/yyyy")
    Adodc4.Recordset.Fields("Telephone") = txtmotel.Text
    Adodc4.Recordset.Fields("Cellphone") = txtmocell.Text
    Adodc4.Recordset.Fields("Educational Attainment") = txtmoeduc.Text
    Adodc4.Recordset.Fields("Course") = txtmocourse.Text
    Adodc4.Recordset.Fields("School") = txtmoschool.Text
    Adodc4.Recordset.Update
    Adodc4.Refresh
End With

'for tblSibling1
With Adodc5.Recordset
    Adodc5.Recordset.AddNew
    Adodc5.Recordset.Fields("Name") = txtsibling1.Text
    Adodc5.Recordset.Fields("Age") = txtage1.Text
    Adodc5.Recordset.Fields("Birthdate") = Format(txtbirth1.Text, "mm/dd/yyyy")
    Adodc5.Recordset.Update
    Adodc5.Refresh
End With

'for tblSibling2
With Adodc6.Recordset
    Adodc6.Recordset.AddNew
    Adodc6.Recordset.Fields("Name") = txtsibling2.Text
    Adodc6.Recordset.Fields("Age") = txtage2.Text
    Adodc6.Recordset.Fields("Birthdate") = Format(txtbirth2.Text, "mm/dd/yyyy")
    Adodc6.Recordset.Update
    Adodc6.Refresh
End With


'for tblSibling3
With Adodc7.Recordset
    Adodc7.Recordset.AddNew
    Adodc7.Recordset.Fields("Name") = txtsibling3.Text
    Adodc7.Recordset.Fields("Age") = txtage3.Text
    Adodc7.Recordset.Fields("Birthdate") = Format(txtbirth3.Text, "mm/dd/yyyy")
    Adodc7.Recordset.Update
    Adodc7.Refresh
End With

'for tblSibling4
With Adodc8.Recordset
    Adodc8.Recordset.AddNew
    Adodc8.Recordset.Fields("Name") = txtsibling4.Text
    Adodc8.Recordset.Fields("Age") = txtage4.Text
    Adodc8.Recordset.Fields("Birthdate") = Format(txtbirth4.Text, "mm/dd/yyyy")
    Adodc8.Recordset.Update
    Adodc8.Refresh
End With

'for tblSibling5
With Adodc9.Recordset
    Adodc9.Recordset.AddNew
    Adodc9.Recordset.Fields("Name") = txtsibling5.Text
    Adodc9.Recordset.Fields("Age") = txtage5.Text
    Adodc9.Recordset.Fields("Birthdate") = Format(txtbirth5.Text, "m/dd/yyyy")
    Adodc9.Recordset.Update
    Adodc9.Refresh
End With










End Sub


Private Sub mnuabout_Click()
    frmAbout.Show
End Sub

Private Sub mnucitprof_Click()
    frmmain.Show
End Sub

Private Sub mnuexit_Click()
    End
End Sub

Private Sub mnumanage_Click()
    frmmanage.Show
End Sub

Private Sub mnuprofile_Click()
    frmstudent.Show
End Sub

im gonna attach the project too for you to see it urself

I got the attachment. Will look soon and will let you know.

I got the attachment. Will look soon and will let you know.

excuse me...
have you seen my project?
well i dont know what exactltly causes the errors in it and i cant find answers so as to do away with those errors..

Yes, i got it. I am just a bit tied up at work. Will look as soon as time permits.:)

Do you have to use the data controls "Adodc" or can the code be changed? It will make it so much easier...

Do you have to use the data controls "Adodc" or can the code be changed? It will make it so much easier...

well i really need the adodc's.

and uhm... i have a database there that has errors.. i need to connect the tblCitizens in "Enforce referential integrity(with all three boxes checked)" with all the other tables except tblUsers in a one-to-many kind of relationship. so that one citizen has a father, a mother and five siblings under him.

what should i do to be able to do that?


and if u dont mind, i kinda need it well, frankly but with courtesy, asap?
well i need to re-study it first for our thesis. thanks!

Do you want this well, frankly with gold plating as well?;)

Just kidding...

Do you want this well, frankly with gold plating as well?;)

Just kidding...

^_^ haha thx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.