My db has two relevant tables, tblGrantee and tblGrantSum. TblGrantSum is a child of tblGrantee with DLCDGrant# as the primary and foreign key in the tables. Both tables have a "StreetAddress" field in them because the same street address is not always used by a Grantee.
My form simply lists the Grantee and DLCDGrant# fields. Below is coding I use on a command button to create a new record in tblGrantSum and open a more complete data entry screen. As a part of the process, I would like the value of StreetAddress in tblGrantee, to be added to the StreetAddress field in the new GrantSum record. I have tried setting default values in the control and tables and some coding options, but I cannot get it to "take". Anyone provide me guidance?
Thanks. Chappie
Private Sub cmdNewRecordDetail_Click()
On Error GoTo Err_cmdNewRecordDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmGrantSumDE"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[DLCDGrant#]=" & "'" & Me![DLCDGrant#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdNewRecordDetail_Click:
Exit Sub
Err_cmdNewRecordDetail_Click:
MsgBox Err.Description
Resume Exit_cmdNewRecordDetail_Click
End Sub
My form simply lists the Grantee and DLCDGrant# fields. Below is coding I use on a command button to create a new record in tblGrantSum and open a more complete data entry screen. As a part of the process, I would like the value of StreetAddress in tblGrantee, to be added to the StreetAddress field in the new GrantSum record. I have tried setting default values in the control and tables and some coding options, but I cannot get it to "take". Anyone provide me guidance?
Thanks. Chappie
Private Sub cmdNewRecordDetail_Click()
On Error GoTo Err_cmdNewRecordDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmGrantSumDE"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stLinkCriteria = "[DLCDGrant#]=" & "'" & Me![DLCDGrant#] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdNewRecordDetail_Click:
Exit Sub
Err_cmdNewRecordDetail_Click:
MsgBox Err.Description
Resume Exit_cmdNewRecordDetail_Click
End Sub