Forum Discussion
aramirezferrer
May 28, 2024Copper Contributor
I have an Issue with event DropDown in combobox in Access's form
n a form, I have a combo box that changes dynamically, i.e., during execution each time I select it. Everything works fine except for the DropDown, which does not "auto-expand." I am sending the code I am using.
Thanks
Const MarcaSQL1 As String = "SELECT pres_marca.Marca FROM pres_marca;"
Const MarcaSQL2 As String = "SELECT pres_modelo.Descripcion FROM pres_modelo WHERE (((pres_modelo.marca)=[textomarca]));"
Const MarcaSQL3 As String = "SELECT pres_cisterna.descripcion, pres_cisterna.Marca FROM pres_cisterna WHERE (((pres_cisterna.Marca) = [Textomarca])) ORDER BY pres_cisterna.Cisterna;"
Private Sub Form_Current()
Seleccion = 1
Caracteristicas.RowSource = MarcaSQL1
Caracteristicas.Requery
End Sub
Private Sub Caracteristicas_AfterUpdate()
If Seleccion = 1 Then
Textomarca = Caracteristicas
Seleccion = 2
Caracteristicas.RowSource = MarcaSQL2
Caracteristicas.setfocus
DoCmd.GoToControl "Caracteristicas"
Caracteristicas.Dropdown
ElseIf Seleccion = 2 Then
Textomodelo = Caracteristicas
Seleccion = 3
Caracteristicas.RowSource = MarcaSQL3
Caracteristicas.Requery
Caracteristicas.setfocus
DoCmd.GoToControl "Caracteristicas"
Caracteristicas.Dropdown
ElseIf Seleccion = 3 Then
TextoCisterna = Caracteristicas
Seleccion = 1
Caracteristicas.RowSource = MarcaSQL1
Caracteristicas.Requery
Caracteristicas.setfocus
DoCmd.GoToControl "Caracteristicas"
Caracteristicas.Dropdown
End If
End Sub
- Julian_SharpLearn ExpertYou have posted on the Microsoft Learn forum which is about training and credentials. You are more likely to get a response on the Access forum https://techcommunity.microsoft.com/t5/access/bd-p/Access
- aramirezferrerCopper Contributor
thanks Julian_Sharp