I have a tbl Afd_Serv with 2 columns named directorat (number) and txtdescrip.
How can i fill the combobox "cboServices" with a value (number) given in the group options "fraDep" (Select case 1 to 4) with the same value of the value in the colum directorat from tbl Afd_Serv.
I written following code :
Code:
Private Sub cboServices_click()
Dim strSQL As String
Debug.Print "Me.fraDep CboServices 1:"; Me.cboServices.Value
'strSQL = "select * from Afd where Directorat = " & Me.fraDep & ";"
' ou si cle est du String:
strSQL = "select [Omschrijving frans] from Afd_Serv where Directorat = " & Me.cboServices & ""
Debug.Print "Me.fraDep CboServices 2:"; Me.cboServices.Value
Me.cboServices.RowSource = strSQL
End Sub
Code:
Private Sub fraDep_AfterUpdate()
.......
Select Case fraDep.Value
Case 1
strDep = "'*'"
libelleDep = "All"
cboServices.Visible = False
Case 2
strDep = "'CEO'"
libelleDep = "CEO"
cboServices.Visible = True
cboServices.Value = 5
cboServices.Requery
Case 3
strDep = "'DGA'"
libelleDep = "DGA"
cboServices.Visible = True
cboServices.Value = 6
cboServices.Requery
Case 4
strDep = "'DGO'"
libelleDep = "DGO"
Case 5
strDep = "'DGS'"
libelleDep = "DGS"
Case Else
strDep = "'Other'"
libelleDep = "Other"
End Select
........