Guest_imported
New member
- Jan 1, 1970
- 0
I have 2 tables namely SFCLOG and HOUSINGINFO. The SFCLOG table contains a field called "ID" which defines every student in the database. The 2nd table HOUSINGINFO contains housing information for the students in the first table. The foreign key in this second table is called "STUDENTID" which is the same as "ID" from the first table.
I have a form which lists students entered into the system along with their ID's. When the user double clicks on their ID's another form opens up with the fields which pertain to the second table so that they can enter the housing info for that particular student. Since the "ID" and the "STUDENTID" fields are the same, when they double click and open the 2nd form the "ID" is already populated in the "STUDENTID" field.
But when the housing info is filled in, it adds all the fields to the 2nd table except the "STUDENTID" field, which I carry over from the first form. (=[Forms]![FrmHousingInfo]![ID])
How can I add the "STUDENTID" field into the 2nd table along with all the other info?
And btw, it adds a "0" for the "STUDENTID", instead of the "ID" passed.
Thanks for your suggestions!
Here is the code I use for the add function:
--------------------------------------------
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub