Ismailmrabet
New member
- Local time
- Today, 01:16
- Joined
- Nov 13, 2020
- Messages
- 4
This post was edited by The_Doc_Man
1. Moved to the correct forum.
2. Edited the code by adding code tags and adding indentation to make it more readable.
3. Added occasional line break to help legibility.
NO OTHER CONTENT WAS ALTERED!
Hi,
I hope you are well..
I would filter Data from a table Access "Table_Fuel" below , using six combo boxes based on six criterias (week,Date,shift,project,IDcontroleur and Référence) for extracting it in a subform "sous_formulaire_extraction" (see pictures below) and using vba code.
But, this code isn't correctly wrote , because I can't extract all the rows of Table source !!!!
So, can you help me to found the error ?
Option Compare Database
CODE :
1. Moved to the correct forum.
2. Edited the code by adding code tags and adding indentation to make it more readable.
3. Added occasional line break to help legibility.
NO OTHER CONTENT WAS ALTERED!
Hi,
I hope you are well..
I would filter Data from a table Access "Table_Fuel" below , using six combo boxes based on six criterias (week,Date,shift,project,IDcontroleur and Référence) for extracting it in a subform "sous_formulaire_extraction" (see pictures below) and using vba code.
But, this code isn't correctly wrote , because I can't extract all the rows of Table source !!!!
So, can you help me to found the error ?
Option Compare Database
CODE :
Code:
Private Sub cbocontroleur_AfterUpdate()
Call searchcriteria
End Sub
Private Sub cboDate_AfterUpdate()
Call searchcriteria
End Sub
Private Sub cboprojet_AfterUpdate()
Call searchcriteria
End Sub
Private Sub cboreference_AfterUpdate()
Call searchcriteria
End Sub
Private Sub cboshift_AfterUpdate()
Call searchcriteria
End Sub
Function searchcriteria()
Dim week, strDate, strshift, strprojet, strIDcontroleur, strreference As String
Dim task, strcriteria As String
If IsNull(Me.cboweek) Then
week = "[semaine] like '*'"
Else
week = "[semaine]= '" & Me.cboweek & "'"
End If
If IsNull(Me.cboDate) Then
strDate = "[Date] like '*'"
Else
strDate = "[Date] = '" & Me.cboDate & "'"
End If
If IsNull(Me.cboshift) Then
strshift = "[shift] like '*'"
Else
strshift = "[shift] = '" & Me.cboshift & "'"
End If
If IsNull(Me.cboprojet) Then
strprojet = "[Intituleprojet] like '*'"
Else
strprojet = "[Intituleprojet] = '" & Me.cboprojet & "'"
End If
If IsNull(Me.cboreference) Then
strreference = "[Référence] like '*'"
Else
strreference = "[Référence] = '" & Me.cboreference & "'"
End If
If IsNull(Me.cbocontroleur) Then
strIDcontroleur = "[ID_controleur] like '*'"
Else
strIDcontroleur = "[ID_controleur] = '" & Me.cbocontroleur & "'"
End If
strcriteria = week & " And" & strDate & " And " & strshift & " And" & strprojet & " And " & strIDcontroleur & " And " & strreference
task = "select * from Table_Fuel where " & strcriteria
Me.sous_formulaire_extraction.Form.RecordSource = task
Me.sous_formulaire_extraction.Form.Requery
End Function
Private Sub cboweek_AfterUpdate()
Call searchcriteria
End Sub
Attachments
Last edited: