paulhenley
Registered User.
- Local time
- Today, 06:18
- Joined
- Apr 16, 2002
- Messages
- 23
I have a form (header) that has a subform (items). I have some code that takes information from the header and populates the item table as default values when a new item is added>
Private Sub Form_Current()
If Me.NewRecord Then
On Error Resume Next 'It should never occur, just to be sure...
Me!itctlordno.DefaultValue = "Forms![CTL]![ctlordno]"
Me!itctlquoteno.DefaultValue = "Forms![CTL]![ctlquoteno]"
Me!itcustordno.DefaultValue = "Forms![CTL]![custordno]"
Me!itentby.DefaultValue = "Forms![CTL]![entby]"
Me!ititemno.DefaultValue = Nz(DMax("[ititemno]", "Soitem", "[itconum]=" & Forms![CTL]![conum]), 0) + 1
End If
End Sub
This coding works well, but if I refer to any of the item fields in If statements elsewhere in the form, the value does not default.
Please can anyone help?
Private Sub Form_Current()
If Me.NewRecord Then
On Error Resume Next 'It should never occur, just to be sure...
Me!itctlordno.DefaultValue = "Forms![CTL]![ctlordno]"
Me!itctlquoteno.DefaultValue = "Forms![CTL]![ctlquoteno]"
Me!itcustordno.DefaultValue = "Forms![CTL]![custordno]"
Me!itentby.DefaultValue = "Forms![CTL]![entby]"
Me!ititemno.DefaultValue = Nz(DMax("[ititemno]", "Soitem", "[itconum]=" & Forms![CTL]![conum]), 0) + 1
End If
End Sub
This coding works well, but if I refer to any of the item fields in If statements elsewhere in the form, the value does not default.
Please can anyone help?