Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Listbox

Status
Not open for further replies.

slr22

MIS
Jun 26, 2002
80
US
I have two different type of listboxes. One that is static and one that is database driven. When I enter an edit page I want the listbox to display the value that is in the database. I can do this with the static listbox by doing the following:

Sub thisPage_onenter()
if (thisPage.firstEntered) then

if (txtType.value = "A") then
LstType.selectByValue("A")
else if (txtType.value = "B") then
LstType.selectByValue("B")
else if (txtType.value = "C") then
LstType.selectByValue("C")
else
txtType.selectByValue("")
end if
end if
end if
end if
END SUB

I'm not sure if this is the most efficient way to do this, but it works. How would I do a similar thing using a database driven listbox. I tried to do this type of format backwords, but that didn't work:

Sub thisPage_onenter()
if (thisPage.firstEntered) then
LstType.getValue(LstType.selectedIndex)= txtType.value
end if
End Sub

Can anyone give me any direction or help on how to do this.

Thanks,
Sandy
 
Well, I figured out my own problem. You use:

Lisbox.selectedIndex = Listbox.selectByText(textbox.value)

and whatever is in the textbox, it goes to that value in the listbox when you enter the page.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top