S
Sandra
On a tabbed main form (PeoplePlaces)I have a datasheet
subform (DonationsList), this subform is from a query
which filters for donation records from a table
(Donations) based upon the PK (PPID)in master
PeoplePlaces table. This form cannot be edited and is
used to scroll through a list of records. The OnClick
event for DonationsList opens a form (DonationsForm)
filtered by the donation transaction id (DID) of the
clicked record. This form allows for all the edits, etc.
and works just fine.
I created a new form DonationsNew, identical to
DonationsForm, but set to DataEntry. I have a NEW button
which opens this form. The first new record entered is
linked to the PPID record in PeoplePlaces, but after that
the PPID is not being passed to the form. Here's what I
have in the OnClick of the NEW button:
Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
MyID = Me.PPID 'get the PPID from the main form
Dim stDocName As String
stDocName = "DonationsNew"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd
Forms!DonationsNew.PPID = MyID
Exit_NewRecord_Click:
Exit Sub
Err_NewRecord_Click:
MsgBox Err.Description
Resume Exit_NewRecord_Click
End Sub
The first problem I ran into is that a record is
automatically created once the PPID field is filled. If
the user closes the form without entering any real data I
still have a garbage record in my Donations table.
The second problem is that only the first new record
receives the PPID value. Trying to enter a subsequent
new record will cause an error "Cannot save record"
because there is no link back to the PeoplePlaces table.
And one last thing I can't see to get right...how
do I refresh the DonationsList datasheet form after a new
record is added to the pop up form?
TIA for any advice,
Sandra
subform (DonationsList), this subform is from a query
which filters for donation records from a table
(Donations) based upon the PK (PPID)in master
PeoplePlaces table. This form cannot be edited and is
used to scroll through a list of records. The OnClick
event for DonationsList opens a form (DonationsForm)
filtered by the donation transaction id (DID) of the
clicked record. This form allows for all the edits, etc.
and works just fine.
I created a new form DonationsNew, identical to
DonationsForm, but set to DataEntry. I have a NEW button
which opens this form. The first new record entered is
linked to the PPID record in PeoplePlaces, but after that
the PPID is not being passed to the form. Here's what I
have in the OnClick of the NEW button:
Private Sub NewRecord_Click()
On Error GoTo Err_NewRecord_Click
MyID = Me.PPID 'get the PPID from the main form
Dim stDocName As String
stDocName = "DonationsNew"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd
Forms!DonationsNew.PPID = MyID
Exit_NewRecord_Click:
Exit Sub
Err_NewRecord_Click:
MsgBox Err.Description
Resume Exit_NewRecord_Click
End Sub
The first problem I ran into is that a record is
automatically created once the PPID field is filled. If
the user closes the form without entering any real data I
still have a garbage record in my Donations table.
The second problem is that only the first new record
receives the PPID value. Trying to enter a subsequent
new record will cause an error "Cannot save record"
because there is no link back to the PeoplePlaces table.
And one last thing I can't see to get right...how
do I refresh the DonationsList datasheet form after a new
record is added to the pop up form?
TIA for any advice,
Sandra