I am trying to write in VB a procedure (or whatever it's called) where CGID, CG First Name AND CG Last Name from the original form will go into the NEW form. I can only get CGID to go in as of now. These are the names in BOTH forms.
I know adding new StLinkCriteria and DoCmd.SQL isn't working
This is what I have for just CGID.
---
Private Sub CGAGDS_Click()
On Error GoTo Err_CGAGDS_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CG_AGDS"
stLinkCriteria = "[CGID]=" & Me![CGID]
DoCmd.SetWarnings False
DoCmd.RunSQL "Insert Into CG_AGDS(CGID) VALUES (" & Me![CGID] & "
"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Save
DoCmd.SetWarnings True
Exit_CGAGDS_Click:
Exit Sub
Err_CGAGDS_Click:
MsgBox Err.Description
Resume Exit_CGAGDS_Click
End Sub
---
Thanks
I know adding new StLinkCriteria and DoCmd.SQL isn't working
This is what I have for just CGID.
---
Private Sub CGAGDS_Click()
On Error GoTo Err_CGAGDS_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CG_AGDS"
stLinkCriteria = "[CGID]=" & Me![CGID]
DoCmd.SetWarnings False
DoCmd.RunSQL "Insert Into CG_AGDS(CGID) VALUES (" & Me![CGID] & "
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Save
DoCmd.SetWarnings True
Exit_CGAGDS_Click:
Exit Sub
Err_CGAGDS_Click:
MsgBox Err.Description
Resume Exit_CGAGDS_Click
End Sub
---
Thanks