M
Mishanya
In my mainform I have 2 subforms linked by child/master field to the mainform
and control button wich toggles the Enabled property of the 2nd subform.
The 1st subform is datasheet, not updatable, shows records entered thru the
2nd subform.
The 2nd subform is single-view, shows by default the last entry recordset
and have NewRecord control button.
In order to enter new record to the 2nd subform, the user is required to
first press the btnEnableToggle in the mainform, then to press btnNewRecord
on the 2nd subform.
Although it is reminded by msgBox popping after pressing btnEnableToggle,
the users ofen skip on pressing the btnNewRecord and start overrighting the
appearing record (since many conrols on it are comboboxes it goes quite
naturally).
I've failed to code either of the 2 buttons so it will execute 2 actions at
once:
1) the 2nd subform btnNewRecord can not bear
change-Enabled-Property-of-My-Form, as it sits on the form itself
2) the mainform btnEnableToggle when having added to its code
Me![2ndSubform].Form!btnNewRecord.SetFocus
DoCmd.GoToRecord , , acNewRec
sends to the new record the whole structure (the mainform and both the
subforms.
I need to to code the btnEnableToggle so it would not directly execute
GoToRecord action, but activate the btnNewRecord instead. Now the code goes
like this:
Private Sub btnEnableToggle_Click()
If Me![2ndSubform].Enabled = False Then
Me![2ndSubform].Enabled = True
Else
Me![2ndSubform].Enabled = False
End If
End Sub
Any suggestions?
and control button wich toggles the Enabled property of the 2nd subform.
The 1st subform is datasheet, not updatable, shows records entered thru the
2nd subform.
The 2nd subform is single-view, shows by default the last entry recordset
and have NewRecord control button.
In order to enter new record to the 2nd subform, the user is required to
first press the btnEnableToggle in the mainform, then to press btnNewRecord
on the 2nd subform.
Although it is reminded by msgBox popping after pressing btnEnableToggle,
the users ofen skip on pressing the btnNewRecord and start overrighting the
appearing record (since many conrols on it are comboboxes it goes quite
naturally).
I've failed to code either of the 2 buttons so it will execute 2 actions at
once:
1) the 2nd subform btnNewRecord can not bear
change-Enabled-Property-of-My-Form, as it sits on the form itself
2) the mainform btnEnableToggle when having added to its code
Me![2ndSubform].Form!btnNewRecord.SetFocus
DoCmd.GoToRecord , , acNewRec
sends to the new record the whole structure (the mainform and both the
subforms.
I need to to code the btnEnableToggle so it would not directly execute
GoToRecord action, but activate the btnNewRecord instead. Now the code goes
like this:
Private Sub btnEnableToggle_Click()
If Me![2ndSubform].Enabled = False Then
Me![2ndSubform].Enabled = True
Else
Me![2ndSubform].Enabled = False
End If
End Sub
Any suggestions?