G
Guest
My form has a button to allow a user to view or add a record if one does not
exist in an associated table. Coding for the button is shown below. It
works fine if there is a record and "works" to the extent that it creates a
new record, but does not display grantee and address values from the parent
form in the new form. Can someone help me? Thanks Lloyd
frmGrantSumDE is the parent form from table tblGrantSum with DLCDGrant# as
the key field
frmCTrackDE is the child form with the table tblCTrack and DLCDGrant# is
also the name of the key field in this table
DLCDGrant# is a string
If IsNull(DLookup("[DLCDGrant#]", "tblCTrack", "[DLCDGrant#] = '" &
[Forms]![frmGrantSumDE].[DLCDGrant#] & "'")) Then
If MsgBox("No Tracking Record Found. Create a New One?",
vbOKCancel) = vbOK Then
DoCmd.OpenForm "frmCTrackGenInfoDE", acNormal, , , acFormAdd
Forms![frmCTrackGenInfoDE].[DLCDGrant#] =
[Forms]![frmGrantSumDE].[DLCDGrant#]
Forms![frmCTrackGenInfoDE].[Grantee] =
[Forms]![frmGrantSumDE].[Grantee]
Forms![frmCTrackGenInfoDE].[StreetAddress] =
[Forms]![frmGrantSumDE].[StreetAddress]
Forms![frmCTrackGenInfoDE].[City] = [Forms]![frmGrantSumDE].[City]
Forms![frmCTrackGenInfoDE].[Zip] = [Forms]![frmGrantSumDE].[Zip]
Else
MsgBox ("Action Canceled")
End If
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "frmCTrackGenInfoDE", acNormal, , "[DLCDGrant#] = '"
& [Forms]![frmGrantSumDE].[DLCDGrant#] & "'"
End If
exist in an associated table. Coding for the button is shown below. It
works fine if there is a record and "works" to the extent that it creates a
new record, but does not display grantee and address values from the parent
form in the new form. Can someone help me? Thanks Lloyd
frmGrantSumDE is the parent form from table tblGrantSum with DLCDGrant# as
the key field
frmCTrackDE is the child form with the table tblCTrack and DLCDGrant# is
also the name of the key field in this table
DLCDGrant# is a string
If IsNull(DLookup("[DLCDGrant#]", "tblCTrack", "[DLCDGrant#] = '" &
[Forms]![frmGrantSumDE].[DLCDGrant#] & "'")) Then
If MsgBox("No Tracking Record Found. Create a New One?",
vbOKCancel) = vbOK Then
DoCmd.OpenForm "frmCTrackGenInfoDE", acNormal, , , acFormAdd
Forms![frmCTrackGenInfoDE].[DLCDGrant#] =
[Forms]![frmGrantSumDE].[DLCDGrant#]
Forms![frmCTrackGenInfoDE].[Grantee] =
[Forms]![frmGrantSumDE].[Grantee]
Forms![frmCTrackGenInfoDE].[StreetAddress] =
[Forms]![frmGrantSumDE].[StreetAddress]
Forms![frmCTrackGenInfoDE].[City] = [Forms]![frmGrantSumDE].[City]
Forms![frmCTrackGenInfoDE].[Zip] = [Forms]![frmGrantSumDE].[Zip]
Else
MsgBox ("Action Canceled")
End If
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "frmCTrackGenInfoDE", acNormal, , "[DLCDGrant#] = '"
& [Forms]![frmGrantSumDE].[DLCDGrant#] & "'"
End If