Getting Values from Listboxes

Lourry

Registered User.
Local time
Today, 06:57
Joined
May 19, 2004
Messages
41
Hello All,

I have 2 cascading listbox working and since I am working from an already existing database in Oracle, I want the new form that I'm creating to save as the same format as before using another application.

In the first listbox, it has items:
IBM
Sony
Compaq
Dell

In the second listbox the items varies according to the value chosen in the first listbox.

SO, for example if the user choose Sony in the first list and Laptop from the second list. The data should be saved as Sony-Laptop, where the selected values from each listbox is concatenated with a hypen in between and saved to a Oracle table.

How can I achieve this? Should I create another textbox that purely does the concatenation and use that textbox and bound it to the field in Oracle table? Also, when retreiving records, if the data is saved as Sony-Laptop, can I do some coding so that the proper items in the listbox is highlighted?

Thanks in advance!

-Lory :confused: :confused:
 
I tried the following but it gave me an error saying "You can't reference a peroperty or method for a control unless the control has the focus"

txtComp.SetFocus = True
txtComp.Text = ""
If lstCat.Value = 0 & lstType.Value = 0 Then
txtComp.Text = "Sony-Laptop"
End If

isn't the line txtComp.SetFocus = true setting the focus on the control?

I hope someone can help me...

Thanks again!

-Lory
 
Lourry said:
I tried the following but it gave me an error saying "You can't reference a peroperty or method for a control unless the control has the focus"

txtComp.SetFocus = True
txtComp.Text = ""
If lstCat.Value = 0 & lstType.Value = 0 Then
txtComp.Text = "Sony-Laptop"
End If

isn't the line txtComp.SetFocus = true setting the focus on the control?

I hope someone can help me...

Thanks again!

-Lory

.SetFocus is a method, not a property...txtComp.SetFocus will set the focus to txtComp.

Sam.
 
dsmaj said:
.SetFocus is a method, not a property...txtComp.SetFocus will set the focus to txtComp.

Sam.

Thank you Sam!!
Is there a property or method that clears the textbox??
 
Lourry said:
Thank you Sam!!
Is there a property or method that clears the textbox??

you could do txtComp.value = ""
 
Hello again,

I typed in the following code but it is still not working(the proper text is not showing up in the textbox)....can anyone see if my code have errors??

If lstCat.Value = 0 & lstType.Value = 0 Then
txtComp.SetFocus
txtComp.Text = "Sony-Laptop"
ElseIf lstCat.Value = 0 & lstType.Value = 1 Then
txtComp.SetFocus
txtComp.Text = "Sony-Desktop"
End If

Please help and many thanks!
-Lory
 
Oh...the above code, I put it in the lstType_AfterUpdate()
 
Hi again,

Does it make a difference because I am using SQL to pull data from a table to populate the cascading listbox. and by doing lstCat.value = 0(referring to the first element in the listbox) doesn't work quite right. and I keep getting error highlighting the line txtComp.value = "Sony-Laptop" saying the validationrule or before update method doesn't allow me to save the data in that control.

Please help!
-Lory
 

Users who are viewing this thread

Back
Top Bottom