Help in VB Please!

Keidy

Registered User.
Local time
Today, 05:58
Joined
Dec 5, 2006
Messages
26
Hi! I'm trying to create three comboboxes an a listbox.
The name of the table is [Equipos críticos]
Three field's names are [Planta], [TAG] and [EQUIPO]
Well my problem is simple when i select a value from the combobox [Texto72] (the first combobox),the other two comboboxes and the listbox change.
The second combobox have the [TAG] field, and the third one include [Equipo]; but the listbox is a mix between [TAG] and [Equipo]. I want to show as a value of the listbox [TAG] , [Equipo] separated by a comma or by a space.

The name of the listbox is Texto86

Texto86.RowSource = "SELECT [Equipos críticos].[TAG]&" "&[Equipo]" & _
"FROM [Equipos críticos]" & _
"WHERE [Equipos críticos].[Planta]= '" & [Texto72].Value & "' " & _
"ORDER BY [Código Planta] ASC;"

I need that information please help me as soon as possible
 
First of all, you should name your listbox with the appropriate identifier instead of text box.

so lstMyListBox or lst and then whatever you are using. If you use text then it is misleading for people following on after you.

Anyway, this should do you:
Code:
Texto86.RowSource = "SELECT [Equipos críticos].[TAG] & ' ' & [Equipo] As TagEquipo " & _
"FROM [Equipos críticos]" & _
"WHERE [Equipos críticos].[Planta]= '" & [Texto72].Value & "' " & _
"ORDER BY [Código Planta] ASC;"

Also, just for info, you don't need ASC for ascending as it is the default unless you use DESC. Also, TagEquipo is just the Alias that I used (you can change it to something more meaningful to you) as you need to specify an alias when concatenating fields.
 
Thanks Ajajajajajaja

Thanks sorry i'm new. thanks for the information i will do it in my home because i have no time at work. If you can help me with some information later it would be very kind of you :D. Because i have to finish this DB before 29th.

Keidy

boblarson said:
First of all, you should name your listbox with the appropriate identifier instead of text box.

so lstMyListBox or lst and then whatever you are using. If you use text then it is misleading for people following on after you.

Anyway, this should do you:
Code:
Texto86.RowSource = "SELECT [Equipos críticos].[TAG] & ' ' & [Equipo] As TagEquipo " & _
"FROM [Equipos críticos]" & _
"WHERE [Equipos críticos].[Planta]= '" & [Texto72].Value & "' " & _
"ORDER BY [Código Planta] ASC;"

Also, just for info, you don't need ASC for ascending as it is the default unless you use DESC. Also, TagEquipo is just the Alias that I used (you can change it to something more meaningful to you) as you need to specify an alias when concatenating fields.
 
hi again

I have a thread that i really need let me send you the link
If you want to check and help me please :confused: I'm really lost

http://www.access-programmers.co.uk/forums/showthread.php?t=119379


boblarson said:
First of all, you should name your listbox with the appropriate identifier instead of text box.

so lstMyListBox or lst and then whatever you are using. If you use text then it is misleading for people following on after you.

Anyway, this should do you:
Code:
Texto86.RowSource = "SELECT [Equipos críticos].[TAG] & ' ' & [Equipo] As TagEquipo " & _
"FROM [Equipos críticos]" & _
"WHERE [Equipos críticos].[Planta]= '" & [Texto72].Value & "' " & _
"ORDER BY [Código Planta] ASC;"

Also, just for info, you don't need ASC for ascending as it is the default unless you use DESC. Also, TagEquipo is just the Alias that I used (you can change it to something more meaningful to you) as you need to specify an alias when concatenating fields.
 

Users who are viewing this thread

Back
Top Bottom