Hi all, and ty for your suggestions that's my issue:
I have a form used to show in a subform the results from the selection of two comboboxes.
These are the combobox name and the relative query on the main table "Documents":
- docType (the DOCUMENT TYPE)
This vba start the query based on the comboboxes.
(tell me if is the right way to perform that).
Now, the issue is that i want to upgrade that SEARCH with another combobox pointing another table:
the new table "RESULTS" has three fields:
- ID (linked with the resID of "DOCUMENTS")
- DOC CODE (one of the code in Documents)
- RESULT (APPROVED, REJECTED)
This table is joint with the "DOCUMENTS" table through a field resID.
When i choose APPROVED, the search must find ALL the documents inside the Documents table that has the type of result linked with the RESULT table with the same code.
EXAMPLE:
TABLE DOCUMENTS
Code = 2222
typeDoc = EXAM
resID = 1
-
Code = 2223
typeDoc = EXAM
resID = 2
TABLE RESULTS
ID = 1
DOC CODE = 2222
RESULT = APPROVED
-
ID = 2
DOC CODE = 2223
RESULT = APPROVED
If i select from comboboxes:
EXAMS and APPROVED
It must show me
code(from documents) = 2222, typeDoc(from documents) = EXAM, result(from RESULT) = APPROVED
-
code(from documents) = 2223, typeDoc(from documents) = EXAM, result(from RESULT) = APPROVED
I hope i explained well...if not ask me.
TY!!!!
I have a form used to show in a subform the results from the selection of two comboboxes.
These are the combobox name and the relative query on the main table "Documents":
Code:
Dim typeSearch As String
If Me.docType.Value = "EMPTY" Then
typeSearch = "select * from Documents where ([code] = " & Me.cliCode & ")"
Else
typeSearch = "select * from Documents where ([typeDoc] = '" & Me.docType & "') and ([code] = " & Me.cliCode & ")"
End If
Me!Submask_docSearch.Form.RecordSource = typeSearch
Me!Submask_docSearch.Form.Requery
- docType (the DOCUMENT TYPE)
Code:
Dim typeSearch As String
If Me.cliCode.Value = "EMPTY" Then
typeSearch = "select * from Documents where ([typeDoc] = " & Me.docType & ")"
Else
typeSearch = "select * from Documents where ([typeDoc] = '" & Me.docType & "') and ([code] = " & Me.cliCode & ")"
End If
Me!Submask_docSearch.Form.RecordSource = typeSearch
Me!Submask_docSearch.Form.Requery
This vba start the query based on the comboboxes.
(tell me if is the right way to perform that).
Now, the issue is that i want to upgrade that SEARCH with another combobox pointing another table:
the new table "RESULTS" has three fields:
- ID (linked with the resID of "DOCUMENTS")
- DOC CODE (one of the code in Documents)
- RESULT (APPROVED, REJECTED)
This table is joint with the "DOCUMENTS" table through a field resID.
When i choose APPROVED, the search must find ALL the documents inside the Documents table that has the type of result linked with the RESULT table with the same code.
EXAMPLE:
TABLE DOCUMENTS
Code = 2222
typeDoc = EXAM
resID = 1
-
Code = 2223
typeDoc = EXAM
resID = 2
TABLE RESULTS
ID = 1
DOC CODE = 2222
RESULT = APPROVED
-
ID = 2
DOC CODE = 2223
RESULT = APPROVED
If i select from comboboxes:
EXAMS and APPROVED
It must show me
code(from documents) = 2222, typeDoc(from documents) = EXAM, result(from RESULT) = APPROVED
-
code(from documents) = 2223, typeDoc(from documents) = EXAM, result(from RESULT) = APPROVED
I hope i explained well...if not ask me.
TY!!!!
Last edited by a moderator: