Including that problem I have 2 others which aren't really problems but questions.
1)
How do I associate a ChildId from the Children table with all the other information in the other tables? Example I want the Emergency Contact table to have a ChildID which relates to the Child in the Children table.
Currently I have done a diagram and I have created Foreign Key constraints from the ChildId in the Children table to the ChildId column in the relevant tables so it has data integrity and you can't delete stuff from the other tables without deleting the child from the children table first. However I am unsure if this will also make the ChildId automatically fill itself and create the relationship?
2)
I am inserting data using parameters seen in this code:
Code:
'Declare Variables
Dim strNPFName As String
Dim strNPLName As String
Dim strNPR As String
Dim strNFName2 As String
Dim strNPLName2 As String
Dim strNPR2 As String
Dim strNPFName3 As String
Dim strNPLName3 As String
Dim strNPR3 As String
Dim strNPFName4 As String
Dim strNPLName4 As String
'CollectionDisallowed
strNPFName = txtNotPermittedFName1.Text
strNPLName = txtNotPermittedLName1.Text
strNPR = txtRelationNotPermitted1.Text
strNFName2 = txtNotPermittedFName2.Text
strNPLName2 = txtNotPermittedLName2.Text
strNPR2 = txtRelationNotPermitted2.Text
strNPFName3 = txtNotPermittedFName3.Text
strNPLName3 = txtNotPermittedLName3.Text
strNPR3 = txtRelationNotPermitted3.Text
strNPFName4 = txtNotPermittedFName4.Text
strNPLName4 = txtNotPermittedLName4.Text
strNPR4 = txtRelationNOtPermitted4.Text
'Insert into collection disallowed
sqlComm.CommandText = "INSERT INTO CollectionDisallowed VALUES (@LastName, @FirstName, @RelationshipToChild);"
sqlComm.Parameters.AddWithValue("@LastName", strNPFName)
sqlComm.Parameters.AddWithValue("@FirstName", strNPLName)
sqlComm.Parameters.AddWithValue("@RelationshipToChild", strRelationship)
'Find out about multiple insertions
So basically this code will insert LastName, FirstName and RelationshipToChildValues into the database creating one entry. However I also want to insert the other 9 Values into the same fields but as seperate entires however still relevant to the same child.
Example:
Entry One
ChildID: 2
LastName: Blogs
FirstName: Joe
RelationshipToChild: Parent
Entry Two
ChildId: 2
LastName: Smith
FirstName: Bob
RelationshipToChild: Friend
So two different entries related to the same child. Is this possible? If so the only way I can think to do this is with another 3 seperate insert statements, is there a better way?
And the third problem is the one in the previous post a mathmatical error overflow, why would that be occuring. I think it is because the field on the form is only inserting a date and not a time aswell how do I get around this?
Thank you for your help so far, I have tried to descirbe my problems as completley as I can and what I think I can do to solve them I just don't know if they would work or not?