Ive tried several iterations of this INSERT INTO statement
and it keeps telling me there is a syntax error.
Its an event procedure from a data entry form (form_AdminRecord) that opens a second form for attachments, when you click on the button.
It will open the second form (form_Attachment) without any issues, but I cant get the Document Number to carry over.
I want the Document Number to carry over to the second form when its opened.
Document Number is a linked field in both underlying tables (tbl_AdminRecord, tbl_Attachment) for the two forms.
Private Sub Show_Attachments_Click()
On Error GoTo Err_Show_Attachments_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "form_Attachment"
stLinkCriteria = "[Document Number]=" & Me![Document Number]
'DoCmd****nSQL "INSERT INTO tbl_Attachment (Document Number) SELECT tbl_AdminRecord.Document Number FROM tbl_AdminRecord"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Show_Attachments_Click:
Exit Sub
Err_Show_Attachments_Click:
MsgBox Err.Description
Resume Exit_Show_Attachments_Click
End Sub
Its an event procedure from a data entry form (form_AdminRecord) that opens a second form for attachments, when you click on the button.
It will open the second form (form_Attachment) without any issues, but I cant get the Document Number to carry over.
I want the Document Number to carry over to the second form when its opened.
Document Number is a linked field in both underlying tables (tbl_AdminRecord, tbl_Attachment) for the two forms.
Private Sub Show_Attachments_Click()
On Error GoTo Err_Show_Attachments_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "form_Attachment"
stLinkCriteria = "[Document Number]=" & Me![Document Number]
'DoCmd****nSQL "INSERT INTO tbl_Attachment (Document Number) SELECT tbl_AdminRecord.Document Number FROM tbl_AdminRecord"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Show_Attachments_Click:
Exit Sub
Err_Show_Attachments_Click:
MsgBox Err.Description
Resume Exit_Show_Attachments_Click
End Sub