how can i put the text i added to database to the combo menu i have in another form?! :confused:

Recommended Answers

All 4 Replies

how can i put the text i added to database to the combo menu i have in another form?! :confused:

Well if you know the text you want to add you can add items to a combo on another form with

TheOtherFormName.TheComboName.Add.AddItem "Item Text"

Alternatively you can select the data again when you load the second form using ADO and add items the same way during the load event of the second form.

what if i dont know what to add?! is it possible?!

another question pls... how can i fill combo box from database?!

public form_load()
dim conn  as adodb.connection
dim rs as adodb.recordset
dim mysql as string 

conn.open "Provider=MSDASQL;Driver={Microsoft Access Driver (*.mdb)};Dbq=" & G_DB_PATH & ";Uid=" & G_DB_USER & ";Pwd=" & G_DB_PASSWORD

Mysql = "Select * from table;"
rs.open mysql,conn,3,3,1

do while not rs.eof
 combo1.additem rs.fields(0).value 
  rs.movenext
loop

rs.close
set rs = nothing
conn.close
set conn = nothing 
end sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.