Click to See Complete Forum and Search --> : combo search with RDO


duke1000
November 5th, 1999, 08:28 PM
Hi :o)

Does anybody know how to search for a record with interactivity when using a ComboBox and RDO programming.

Thanks ;-)

Duke1000 :-)

Aaron Young
November 5th, 1999, 09:31 PM
You weren't very precise, so here's my interpretation of your question:

Create a Form with a Combobox set the Style to Simple and Make it a fair size, same as a Listbox would be. Create an ODBC DSN for the NorthWind Example MDB, then set a Reference to the MS Remote Data Object Library:

private oCon as new rdoConnection
private oRs as rdoResultset

private Sub Combo1_KeyUp(KeyCode as Integer, Shift as Integer)
Dim sTmp as string
Dim iPos as Integer
set oRs = oCon.OpenResultset("SELECT FirstName FROM Employees WHERE FirstName LIKE '" & Combo1 & "%' ORDER BY FirstName", rdOpenForwardOnly)
iPos = Combo1.SelStart
sTmp = Combo1
Combo1.Clear
While Not oRs.EOF
Combo1.AddItem oRs(0)
oRs.MoveNext
Wend
Combo1.SelText = sTmp
Combo1.SelStart = iPos
End Sub

private Sub Form_Load()
oCon.Connect = "DSN=NorthWind;uid=;pwd=;"
oCon.CursorDriver = rdUseNone
oCon.EstablishConnection
Combo1 = ""
End Sub

private Sub Form_Unload(Cancel as Integer)
set oRs = nothing
oCon.Close
set oCon = nothing
End Sub





Aaron Young
Analyst Programmer
adyoung@win.bright.net
aarony@redwingsoftware.com

duke1000
November 6th, 1999, 10:54 AM
Hi Aaron :o)

Thanks for answering, but like you said, I was'nt precise enough. That's my fault.

Here's the new question. I have multiples TextBox and a ComboBox to search for record. What I'd like to know is how to change the TextBoxes content interactively with the record that I found in the ComboBox (by typing in or by selecting an item in the list).

I'm still working with RDO.

Thanks

Duke1000 :o)