R
Renee
Good morning all,
I have a parent form with a subform. When a selection is made on the
parent form, the subform displays related records. If there are no records,
the subform creates the initial record.
'Create record
'If this is a new record, enter the week number
If Not IsNull(Me.Parent.EmpID) Then
If Me.NewRecord = True Then
varWeek = DMax("[Week]", "[tbl_HRlog]", "[EmpID] = '" &
Me.Parent.EmpID & "'")
Me.EmpID = Forms![frm_Log]!EmpID 'frm_log is the parent form
Me.[Week] = Nz(varWeek, 0) + 1 'fill in the week number
End If
End If
Problem is, when the inital record is created, I have'nt also been able to
save it. When the report command button on the parent form is clicked, it
doesn't display the newly created record since it hasn't been saved.
I have tried put the following code:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
on the following events:
sub form's OnDirty
sub form's "Week" textbox OnChange event
sub form's Before Insert and After Insert
sub form's Lost Focus
sub form's Data Change
parent form's command button that pulls the reports
I would greatly appreciate any suggestions!
Renee
I have a parent form with a subform. When a selection is made on the
parent form, the subform displays related records. If there are no records,
the subform creates the initial record.
'Create record
'If this is a new record, enter the week number
If Not IsNull(Me.Parent.EmpID) Then
If Me.NewRecord = True Then
varWeek = DMax("[Week]", "[tbl_HRlog]", "[EmpID] = '" &
Me.Parent.EmpID & "'")
Me.EmpID = Forms![frm_Log]!EmpID 'frm_log is the parent form
Me.[Week] = Nz(varWeek, 0) + 1 'fill in the week number
End If
End If
Problem is, when the inital record is created, I have'nt also been able to
save it. When the report command button on the parent form is clicked, it
doesn't display the newly created record since it hasn't been saved.
I have tried put the following code:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
on the following events:
sub form's OnDirty
sub form's "Week" textbox OnChange event
sub form's Before Insert and After Insert
sub form's Lost Focus
sub form's Data Change
parent form's command button that pulls the reports
I would greatly appreciate any suggestions!
Renee