Error querying Empty List Box

Mylton

Member
Local time
Yesterday, 17:53
Joined
Aug 3, 2019
Messages
124
Good afternoon

I have 01 table called Tbl_Cadastro_Menu
With Id_Cadastro_Menu (automatic key)
Menu_Grupo (short text)
Menu_Grupo (short text)
Menu_Descricao (short text)

In the form I put two list Boxes
1) ListOptions
2) ListSelectOption



in the form
in 01 ListBox
as source Menu_Group
in Origin SELECT Tbl_Cadastro_Menu.Menu_Grupo FROM Tbl_Cadastro_Menu GROUP BY Tbl_Cadastro_Menu.Menu_Grupo ORDER BY Tbl_Cadastro_Menu.Menu_Grupo;

In the AfterUpdate Event of this List

Private Sub ListOpcoes_AfterUpdate()
Me.ListaSelecionarOpcao.SetFocus
Me.ListaSelecionarOpcao.Requery
Me.ListaSelecionarOpcao.Dropdown
End Sub


Gives error in compilation error: Method or member not found Me.ListaSelecionarOpcao.Dropdown (Blue in .droppdown).

Two doubts:
1) How do I solve:
2) How do I ask to open the Form chosen in the second List box?


Thanks.

I have attached an example



Em meu idioma

Boa tarde

Tenho 01 tabela chamada Tbl_Cadastro_Menu
Com Id_Cadastro_Menu (chave automática)
Menu_Grupo (texto curto)
Menu_Grupo (texto curto)
Menu_Descricao (texto curto)

No form coloquei duas list Box
1) ListaOpcoes
2) ListSelecionarOpcao



No form
na 01 ListaBox
como fonte Menu_Grupo
na Origem SELECT Tbl_Cadastro_Menu.Menu_Grupo FROM Tbl_Cadastro_Menu GROUP BY Tbl_Cadastro_Menu.Menu_Grupo ORDER BY Tbl_Cadastro_Menu.Menu_Grupo;

No Evento AfterUpdate desta Lista

Private Sub ListaOpcoes_AfterUpdate()
Me.ListaSelecionarOpcao.SetFocus
Me.ListaSelecionarOpcao.Requery
Me.ListaSelecionarOpcao.Dropdown
End Sub


Dá erro em erro de compilação: Método ou membro não encontrado Me.ListaSelecionarOpcao.Dropdown (Azulado em .droppdown).

Duas dúvidas:
1) Como resolvo:
2) Como peço para abrir o Form escolhido na segunda caixa Lista?


Obrigado.

Anexei um exemplo
 

Attachments

I redid the box and the error remains.
Attached version 02.
thanks
 

Attachments

You can not "dropdown" a list box, only a combo box. What is that line intended to accomplish? I would just delete it.
 
deleted
But the options that belong to the chosen option do not appear in the second list box.
Where did I go wrong?
 
I want to create a menu.
Where the first list box provides the options and the second one allows you to open the form within that option. So maybe I can create a way to create a user group.
At least that's my thinking.

hahahaha
 
ListaSelecionarOpcao has no row source, so requerying won't accomplish anything. It either needs to have a row source that refers to the first listbox for a criteria, or you'd need to set it in your code. Basically you're doing this but with listboxes:

 
Once you get that working, to open the selected form you can refer to the listbox:

DoCmd.OpenForm Me.ListaSelecionarOpcao.Column(x)

Where x is the zero-based column containing the form name. It has to be the exact form name, not what you currently have in that table.
 
The ripple effect worked. However, the title appears in the second list box.
How do I remove this title?
 

Attachments

  • Teste.png
    Teste.png
    200.7 KB · Views: 81
Change the ColumnHeads property of the listbox.
 
I resolved this issue.
Now I go to the opening of the from
 
Where x is the zero-based column containing the form name. It has to be the exact form name, not what you currently have in that table

what did you mean by that?
I added the Name_Form field to the table.
in the click event
I placed
DoCmd.OpenForm Me.ListSelectOption.Column(3)

Where 3 would be the third field in the table.

Where am I going wrong?
 
zero-based means the first column is number 0. The third field in the table (row source more accurately) is 2.
 
It worked.
Thank you for your help.
Happy Holidays.
Hugs.
 
Happy to help, and happy holidays!
 

Users who are viewing this thread

Back
Top Bottom