L
lynxsta911 via AccessMonster.com
Hello all ...
I have a main form (frmOrderEntry) which contains 13 subform controls
(ctrOptionEntry1, ctrOptionEntry2, ...) and 14 command buttons. Each command
button changes the RecordSource of each subform. (It runs like a tab control,
but without having to place 13 subforms on each tab.)
Each subform control alternates between a continuous form and a single form,
depending on which RecordSource has been selected. As each subform is
identical (except for DefaultView), all I want to do at this point is change
the height of each subform control depending on whether it's SourceObject is
a continuous or single form. But this would cause some subform controls to
overlap, so I would like to adjust each subform control's positioning to be
in relation to the subform control above it. Is this even possible?
Following is the code that triggers the above events... (OptionTab references
a category which used to be on a Tab Control, but is now done by the command
buttons)
Public Sub FilterSubForm(ctrOptionTab As Control, ctrCategoryNum As Control,
ctrOptionEntryNum As Control, strSubForm As String, strSubFormcont As String)
'Sets each subform as single form or continuous, based on SingleSelect
If (DLookup("SingleSelect", "tblCategory", "CategoryID = " &
ctrCategoryNum)) = -1 Then
ctrOptionEntryNum.SourceObject = strSubForm
Else
ctrOptionEntryNum.SourceObject = strSubFormcont
End If
'Toggles between OptionalPricing or not, depending on togOptionalPricing
Dim strSubFilter1 As String
Dim strSubFilter2 As String
Dim strNum As String
If Forms!frmOrderEntry!togOptionalPricing = True Then
strNum = " = -1"
Else
strNum = " <> -1"
End If
'Filters each subform by the button that was selected
strSubFilter1 = "" & _
"SELECT tblOptionEntry.OptionID, tblOptionEntry.OrderID,
tblOptionEntry.Option, tblOptionEntry.Quantity, " & _
"tblOptionEntry.Price, tblOptionEntry.Total, tblOptionEntry.
OptionText, tblOptionEntry.OptionTab, tblOptionEntry.Category, " & _
"tblOptionEntry.OptionalPricing " & _
"FROM tblOptionEntry " & _
"WHERE tblOptionEntry.OptionTab = " & ctrOptionTab & _
" AND tblOptionEntry.Category = " & ctrCategoryNum
strSubFilter2 = " AND tblOptionEntry.OptionalPricing" & strNum
ctrOptionEntryNum.Form.RecordSource = strSubFilter1 & strSubFilter2
End Sub
Any help is greatly appreciated!
Sorry if my code is junk ... I'm a learn-as-I-go VB'er.
Lynx
I have a main form (frmOrderEntry) which contains 13 subform controls
(ctrOptionEntry1, ctrOptionEntry2, ...) and 14 command buttons. Each command
button changes the RecordSource of each subform. (It runs like a tab control,
but without having to place 13 subforms on each tab.)
Each subform control alternates between a continuous form and a single form,
depending on which RecordSource has been selected. As each subform is
identical (except for DefaultView), all I want to do at this point is change
the height of each subform control depending on whether it's SourceObject is
a continuous or single form. But this would cause some subform controls to
overlap, so I would like to adjust each subform control's positioning to be
in relation to the subform control above it. Is this even possible?
Following is the code that triggers the above events... (OptionTab references
a category which used to be on a Tab Control, but is now done by the command
buttons)
Public Sub FilterSubForm(ctrOptionTab As Control, ctrCategoryNum As Control,
ctrOptionEntryNum As Control, strSubForm As String, strSubFormcont As String)
'Sets each subform as single form or continuous, based on SingleSelect
If (DLookup("SingleSelect", "tblCategory", "CategoryID = " &
ctrCategoryNum)) = -1 Then
ctrOptionEntryNum.SourceObject = strSubForm
Else
ctrOptionEntryNum.SourceObject = strSubFormcont
End If
'Toggles between OptionalPricing or not, depending on togOptionalPricing
Dim strSubFilter1 As String
Dim strSubFilter2 As String
Dim strNum As String
If Forms!frmOrderEntry!togOptionalPricing = True Then
strNum = " = -1"
Else
strNum = " <> -1"
End If
'Filters each subform by the button that was selected
strSubFilter1 = "" & _
"SELECT tblOptionEntry.OptionID, tblOptionEntry.OrderID,
tblOptionEntry.Option, tblOptionEntry.Quantity, " & _
"tblOptionEntry.Price, tblOptionEntry.Total, tblOptionEntry.
OptionText, tblOptionEntry.OptionTab, tblOptionEntry.Category, " & _
"tblOptionEntry.OptionalPricing " & _
"FROM tblOptionEntry " & _
"WHERE tblOptionEntry.OptionTab = " & ctrOptionTab & _
" AND tblOptionEntry.Category = " & ctrCategoryNum
strSubFilter2 = " AND tblOptionEntry.OptionalPricing" & strNum
ctrOptionEntryNum.Form.RecordSource = strSubFilter1 & strSubFilter2
End Sub
Any help is greatly appreciated!
Sorry if my code is junk ... I'm a learn-as-I-go VB'er.
Lynx