I have a parent table (tblLabels) and a child table (tblRevision) where the revision history for the parent table is kept. The parent table is populated via an excel import and may have several records imported at once. Instead of having the user manually enter a new record note in the child table for each record imported into the parent table, I've created a form that collects the necessary data (date, person who added the record, person who authorized the record, and notes) and then creates a revision history for each new record.
This is what I have so far:
When I run the code nothing happens. No error, no new records create, etc. My suspicion is that I may need to use an INSERT INTO query instead of an UPDATE query, but I'm not sure how to go about matching up the foreign keys if that's the case.
Can anyone give me a nudge in the right direction?
Thanks!
This is what I have so far:
Code:
Private Sub cmdAddNotes_Click()
Dim strSQL As String
Dim RevisionDate As String
Dim RevisionRevisedBy As String
Dim RevisionDesc As String
Dim RevisionAuthorizedBy As String
Dim RevisionLabel As String
RevisionDate = txtDateAdded
RevisionRevisedBy = cboRecordCreator
RevisionAuthorizedBy = cboRecordRequester
RevisionDesc = txtNotes
strSQL = "UPDATE (tblLabels LEFT JOIN tblRevisions ON tblLabels.LabelID = tblRevisions.RevLabel)" & _
"SET tblRevisions.RevDesc ='" & RevisionDesc & "'" & _
"WHERE (((tblRevisions.RevLabel) Is Null));"
When I run the code nothing happens. No error, no new records create, etc. My suspicion is that I may need to use an INSERT INTO query instead of an UPDATE query, but I'm not sure how to go about matching up the foreign keys if that's the case.
Can anyone give me a nudge in the right direction?
Thanks!