L'apprentis
Redcifer
- Local time
- Today, 15:21
- Joined
- Jun 22, 2005
- Messages
- 177
Hi. i am facing a fairly complex problem:
I have a search form with 6 Combo box use to select the criteria of a query with 14 fields bound to a continuous subform.
Thanks to UNCLEGIZMO (forum user), I managed to insert in my database a code that allow me to select all the data for each combo box ( like if there was no Criteria on the selected field).
Here is a quick description of the method used:
1. In modul
2.CboBox
Row source=SELECT DISTINCT TblRecords.Field FROM TblRecords UNION SELECT "*" FROM TblRecords;
After update event:
Private Sub CboField_AfterUpdate()
VariableField = CboField
SfrmSearchRecord.Requery
Me.Requery
End Sub
3.Record Source of the subform
Criteria of the corresponding field is:
This allow me to select all the record when * is selected.
The thing is if I want to make this form really complete and 100% usefull, I would need to add a feature, which, seems quite complicated.
Here is a set of record:
Record1-----FieldA=1----FieldB=1
Record2-----FieldA=1----FieldB=2
Record3-----FieldA=1----FieldB=3
Record4-----FieldA=2----FieldB=2
Record5-----FieldA=3----FieldB=1
Record6-----FieldA=3----FieldB=2
The user should be able to see all the records and able to enter up to 3 values for field B and those values should all have the same FieldA:
- If 1 only is entered for fieldB, the subform should only show Record 1,2,3,5,6
- If 2 is entered for fieldB, the subform should show all the Record
(because it exists for each set of fieldA)
- If 1 and 2 are entered for fieldB, the subform should only show Record 1,2,3,5,6
- If 3 is entered for fieldB, the subform should only show Record 1,2,3
....
I know that for selecting the field B, I would need to Insert 3 Cbo box and that's about it, i am really confused on where to start to achieve what I would like to. I know that this it a very specific question and might be time consuming but if anybody has any suggestion that could help me, I would really be gratefull.
I have a search form with 6 Combo box use to select the criteria of a query with 14 fields bound to a continuous subform.
Thanks to UNCLEGIZMO (forum user), I managed to insert in my database a code that allow me to select all the data for each combo box ( like if there was no Criteria on the selected field).
Here is a quick description of the method used:
1. In modul
Public VariableField As Variant
Public Function FctAll()
If IsNull(VariableField) Or VariableField = "" Then
FctAll = "*"
Else
FctAll = VariableField
End If
End Function
2.CboBox
Row source=SELECT DISTINCT TblRecords.Field FROM TblRecords UNION SELECT "*" FROM TblRecords;
After update event:
Private Sub CboField_AfterUpdate()
VariableField = CboField
SfrmSearchRecord.Requery
Me.Requery
End Sub
3.Record Source of the subform
Criteria of the corresponding field is:
Code:
Like FctAll()
This allow me to select all the record when * is selected.
The thing is if I want to make this form really complete and 100% usefull, I would need to add a feature, which, seems quite complicated.
Here is a set of record:
Record1-----FieldA=1----FieldB=1
Record2-----FieldA=1----FieldB=2
Record3-----FieldA=1----FieldB=3
Record4-----FieldA=2----FieldB=2
Record5-----FieldA=3----FieldB=1
Record6-----FieldA=3----FieldB=2
The user should be able to see all the records and able to enter up to 3 values for field B and those values should all have the same FieldA:
- If 1 only is entered for fieldB, the subform should only show Record 1,2,3,5,6
- If 2 is entered for fieldB, the subform should show all the Record
(because it exists for each set of fieldA)
- If 1 and 2 are entered for fieldB, the subform should only show Record 1,2,3,5,6
- If 3 is entered for fieldB, the subform should only show Record 1,2,3
....
I know that for selecting the field B, I would need to Insert 3 Cbo box and that's about it, i am really confused on where to start to achieve what I would like to. I know that this it a very specific question and might be time consuming but if anybody has any suggestion that could help me, I would really be gratefull.