C
Casey Ulve via AccessMonster.com
I currently have a FE that constists of a log form and then a main form.
This main form has a generice subform, what I call a window. This window is
where all other forms that the users need open up. I used to have buttons
that opened opened them up, but because of clutter I changed to a combo
box. This combo box gets its data from a table that has a field for the
users name of the subform, a field for the actual name of the form and then
a field that is either blank or says "None". Three of the subForms that
open in the window need the account number field filled in on main form
before they open. I created some code attached to an enter button that must
be pressed after the subForm is selected from the Combo box.This works
somewhat but is giving me two problems. The code is below. Any help would
be appreciated.
1. If there is nothing in the cmtAccount field on the main form it just
flags all subForms as needing the cmtAccount filled.
2. There is a reset button on the main form to clear all fields, or reset
back to the forms state when it first opens. Once the form has been reset
and the user selects a subform from the Combo box, code for checking the
cmtAccount field just gets bypassed and the subforms open.
Please be gentle on the the critique of my code, I just gave myself a crash
course about two months ago
Private Sub cmdEnter_Click()
If Me.cbWindow.Column(3) = "None" Then
GoTo OpenSubForm
Else
GoTo ConfirmField
End If
ConfirmField:
If IsNull(Me.cmtAccount) Then
MsgBox "Please Enter an Account#"
cmtAccount.SetFocus
Exit Sub
Else
GoTo OpenSubForm
End If
OpenSubForm:
'Open multiSubForm with chosen subForm
Dim strSubName As String
strSubName = Me.cbWindow.Column(2)
Me!multiSubForm.SourceObject = strSubName
multiSubForm.Visible = True
End Sub
This main form has a generice subform, what I call a window. This window is
where all other forms that the users need open up. I used to have buttons
that opened opened them up, but because of clutter I changed to a combo
box. This combo box gets its data from a table that has a field for the
users name of the subform, a field for the actual name of the form and then
a field that is either blank or says "None". Three of the subForms that
open in the window need the account number field filled in on main form
before they open. I created some code attached to an enter button that must
be pressed after the subForm is selected from the Combo box.This works
somewhat but is giving me two problems. The code is below. Any help would
be appreciated.
1. If there is nothing in the cmtAccount field on the main form it just
flags all subForms as needing the cmtAccount filled.
2. There is a reset button on the main form to clear all fields, or reset
back to the forms state when it first opens. Once the form has been reset
and the user selects a subform from the Combo box, code for checking the
cmtAccount field just gets bypassed and the subforms open.
Please be gentle on the the critique of my code, I just gave myself a crash
course about two months ago
Private Sub cmdEnter_Click()
If Me.cbWindow.Column(3) = "None" Then
GoTo OpenSubForm
Else
GoTo ConfirmField
End If
ConfirmField:
If IsNull(Me.cmtAccount) Then
MsgBox "Please Enter an Account#"
cmtAccount.SetFocus
Exit Sub
Else
GoTo OpenSubForm
End If
OpenSubForm:
'Open multiSubForm with chosen subForm
Dim strSubName As String
strSubName = Me.cbWindow.Column(2)
Me!multiSubForm.SourceObject = strSubName
multiSubForm.Visible = True
End Sub