Error querying Empty List Box (1 Viewer)

Mylton

Member
Local time
Today, 05:55
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

  • Teste1.zip
    38.2 KB · Views: 62

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
I redid the box and the error remains.
Attached version 02.
thanks
 

Attachments

  • Teste2.accdb
    640 KB · Views: 70

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
You can not "dropdown" a list box, only a combo box. What is that line intended to accomplish? I would just delete it.
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
deleted
But the options that belong to the chosen option do not appear in the second list box.
Where did I go wrong?
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
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
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
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:

 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
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.
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
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: 55

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
Change the ColumnHeads property of the listbox.
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
I resolved this issue.
Now I go to the opening of the from
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
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?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
zero-based means the first column is number 0. The third field in the table (row source more accurately) is 2.
 

Mylton

Member
Local time
Today, 05:55
Joined
Aug 3, 2019
Messages
124
It worked.
Thank you for your help.
Happy Holidays.
Hugs.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:55
Joined
Aug 30, 2003
Messages
36,129
Happy to help, and happy holidays!
 

Users who are viewing this thread

Top Bottom