sja13
Professional Idiot
- Local time
- Today, 01:22
- Joined
- May 3, 2017
- Messages
- 63
I have a Form which is a main menu form, on which there are buttons which, when clicked, invoke other Forms. These other Forms have a Query as their ControlSource, and this Query is unfiltered, so it gets all of the records in a particular Table.
The "master" form is called (unsurprisingly) "frmMainMenu"
The VBA invoked when the Command Button "cmdManufacturer" is clicked on frmMainMenu follows:-
In the Form frmManufacturer, the following code exists, which I believe is fired when the Form becomes current
Within the VBA code AtNewRecord the following code exists
Using a Watch, after the cmdManufacturer button on frmMainMenu is clicked I can see that "frm.Name" in the above code is still set to "frmMainMenu", which implies that
isn't doing what I thought it was (i.e. getting details for the Form referenced in the DoCmd.OpenForm instruction).
Can anyone help me by explaining what misconceptions I'm labouring under?
Thanks in advance....
The "master" form is called (unsurprisingly) "frmMainMenu"
The VBA invoked when the Command Button "cmdManufacturer" is clicked on frmMainMenu follows:-
Code:
Private Sub cmdMMManufacturers_Click()
DoCmd.OpenForm ("frmManufacturer")
End Sub
Code:
Private Sub Form_Current()
Call AtNewRec(Recordset)
End Sub
Code:
Public Sub AtNewRec(recSet As Recordset)
Dim frm As Form
Dim lngC As Long
Dim lngL As Long
'*
'** Get addressability to the
'** currently displayed Form, and
'** identify the current record's
'** position and the final record's position.
'*
Set frm = Screen.ActiveForm
Select Case UCase(frm.Name)
Case "FRMBOARD", _
"FRMITEM", _
"FRMITEMTYPE", _
"FRMLOCATION", _
"FRMMANUFACTURER"
Case Else
Exit Sub
End Select
With recSet
lngC = .AbsolutePosition + 1
lngL = .RecordCount
End With
Code:
Set frm = Screen.ActiveForm
Can anyone help me by explaining what misconceptions I'm labouring under?
Thanks in advance....