Etxezarreta
Member
- Local time
- Today, 06:09
- Joined
- Apr 13, 2020
- Messages
- 175
Hello,
I use the following code to populate a combo in a form called f_GestionPF.
I have been trying to do the same thing to populate a combo called "combo_ProduitSemiFini" in the subform called "sf_CompositionProduitsFinis" of this form,
I know the problem sets in this code line :
Me.combo_FiltreNom.RowSource = sSelect & sWhere & sOrderBy
I tried Me!sf_CompositionProduitsFinis.Form!combo_ProduitSemiFini.rowsource = sSelect & sWhere & sOrderBy, but it doesn't work, would you have any idea please?
Thanks.
Etxe
I use the following code to populate a combo in a form called f_GestionPF.
I have been trying to do the same thing to populate a combo called "combo_ProduitSemiFini" in the subform called "sf_CompositionProduitsFinis" of this form,
I know the problem sets in this code line :
Me.combo_FiltreNom.RowSource = sSelect & sWhere & sOrderBy
I tried Me!sf_CompositionProduitsFinis.Form!combo_ProduitSemiFini.rowsource = sSelect & sWhere & sOrderBy, but it doesn't work, would you have any idea please?
Thanks.
Etxe
Code:
Private Sub combo_FiltreNom_KeyPress(KeyAscii As Integer)
On Error GoTo GestionnaireErreur
If KeyAscii > 32 Then
sAccumText = sAccumText & Chr(KeyAscii)
ElseIf KeyAscii = 8 Then 'Backspace Key
If Len(sAccumText) > 1 Then
sAccumText = Left(sAccumText, Len(sAccumText) - 1)
ElseIf Len(sAccumText) = 1 Then
sAccumText = ""
End If
If Nz(Me.combo_FiltreNom.Text, "") = "" Then sAccumText = ""
End If
Dim sWhere As String
If sAccumText <> "" Then
sWhere = "WHERE [CODE_SAGE] LIKE '*" & Replace(sAccumText, "'", "''") & "*' OR [INTITULES_GENERIQUES_PRODUITS_FINIS] LIKE '*" & Replace(sAccumText, "'", "''") & "*' "
End If
Me.combo_FiltreNom.RowSource = sSelect & sWhere & sOrderBy
If KeyAscii = 27 Then 'Escape
sAccumText = ""
ElseIf KeyAscii = 8 And sAccumText = "" Then
'Backspace key, do nothing
ElseIf KeyAscii = 9 Then 'Tab
sAccumText = ""
Else
Me.combo_FiltreNom.Dropdown
End If
'This textbox not required, only here to show you what you've been typing
Me.txtAccumText = sAccumText
Exit Sub
GestionnaireErreur:
MsgBox "Une erreur s'est produite: " & Err.Number & "-" & Err.Description, vbOKOnly + vbInformation