R
Ron V
In my database I have a Form/Subform setup that was
created through the wizard and it created a Toggle button
with a filter that would associate the child form with the
parent. Everything works fine - A new record is added and
the subrecord is created when the Toggle button is clicked.
Now the problem I'm running into has to do with the
Duplicate Record button I've created on the Parent Form.
From time to time a record would need to be duplicated
just for purposes of less data entry, because just a
couple of field values would need to be changed.
The button creates a duplicate of the Main record, but
when the Toggle button is clicked, the sub record is not
associated with the main record.
I've tried setting the value of the Child form ID field to
the value of the Parent form ID field and it doesn't
work. I'll put the code below so you can see how it's
setup.
Please Help!! I hope this makes some sense.
Thanks - Ron
-------------------------------------------------
Tables [tblDMJobInfo].[DMJobID]
1 to Many--->[tblDMJobTracking].[DMJobIDInfo]
Parent Form & ID field [frmDMJobinfo].[DMJobID]
RecordSource = [tblDMJobinfo]
Child Form & ID Field [frmDmJobTrackingSub].[DMJobIDinfo]
RecordSource = [tblDmJobTracking]
---------------------------------------
Sub ToggleLink_Click()'Code attached to Toggle on parent
form. This works fine.
On Error GoTo ToggleLink_Click_Err
If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm 'See Filter sub below
End If
ToggleLink_Click_Exit:
Exit Sub
---------------------------------
Private Sub FilterChildForm() 'Doesn't work properly when
a record on the Parent form is copied and added
If Me.NewRecord Then
Forms![frmDmJobTrackingSub].DataEntry = True
Forms![frmDmJobTrackingSub].DMJobIDinfo = Me.
[DMJobID]
Else
Forms![frmDmJobTrackingSub].Filter
= "[DMJobIDinfo] = " & Me.[DMJobID]
Forms![frmDmJobTrackingSub].FilterOn = True
End If
End Sub
created through the wizard and it created a Toggle button
with a filter that would associate the child form with the
parent. Everything works fine - A new record is added and
the subrecord is created when the Toggle button is clicked.
Now the problem I'm running into has to do with the
Duplicate Record button I've created on the Parent Form.
From time to time a record would need to be duplicated
just for purposes of less data entry, because just a
couple of field values would need to be changed.
The button creates a duplicate of the Main record, but
when the Toggle button is clicked, the sub record is not
associated with the main record.
I've tried setting the value of the Child form ID field to
the value of the Parent form ID field and it doesn't
work. I'll put the code below so you can see how it's
setup.
Please Help!! I hope this makes some sense.
Thanks - Ron
-------------------------------------------------
Tables [tblDMJobInfo].[DMJobID]
1 to Many--->[tblDMJobTracking].[DMJobIDInfo]
Parent Form & ID field [frmDMJobinfo].[DMJobID]
RecordSource = [tblDMJobinfo]
Child Form & ID Field [frmDmJobTrackingSub].[DMJobIDinfo]
RecordSource = [tblDmJobTracking]
---------------------------------------
Sub ToggleLink_Click()'Code attached to Toggle on parent
form. This works fine.
On Error GoTo ToggleLink_Click_Err
If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm 'See Filter sub below
End If
ToggleLink_Click_Exit:
Exit Sub
---------------------------------
Private Sub FilterChildForm() 'Doesn't work properly when
a record on the Parent form is copied and added
If Me.NewRecord Then
Forms![frmDmJobTrackingSub].DataEntry = True
Forms![frmDmJobTrackingSub].DMJobIDinfo = Me.
[DMJobID]
Else
Forms![frmDmJobTrackingSub].Filter
= "[DMJobIDinfo] = " & Me.[DMJobID]
Forms![frmDmJobTrackingSub].FilterOn = True
End If
End Sub