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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need combo box refreshed after adding a user to the database

Status
Not open for further replies.

piranna

Technical User
Apr 6, 2004
4
0
0
CA
Hello,

I have a form to add a new user to the database,but when i go to the combo box of the form that will allow me to pick the the new user and the software the query that controls that combo box is not updated with that new user. Does anyone know how to have te new user appear after adding them to the database.

Any comments/suggestions would be greatly appreciated.

Anna
 
At the end of the procedure that you add the name to the database call the procedure you use to fill the combo.

Matt

 
Matt,

What i have is one form that updates the user table.
The other form that has the combo box is linked to a query with two tables.
So i'm not using a procedure to fill the combo box.
I'm interested in knowing how though.
Thank you for your reply please continue helping me....

Anna
 
This assumes you are using Access:

' Add a reference to Microsoft ActiveX Data Objects X.X Library
Dim CONN As ADODB.Connection
Dim RS As ADODB.Recordset
Set CONN = New ADODB.Connection
Set RS = New ADODB.Recordset
CONN.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\VBFiles\Supplier Tracking Interface\Supplier.mdb;User Id=;Password="
RS.Open "SELECT * FROM Passwords", CONN, adOpenStatic, adLockReadOnly
Do Until RS.EOF
Combo1.AddItem RS.Fields("UserName").Value
RS.MoveNext
Loop
RS.Close
CONN.Close
Set RS = Nothing
Set CONN = Nothing

Swi
 
I'm creating a inventory database of all the software/hardware/user/computernames of a small company.
First you need to add a new user.
All my combo boxes for the other forms like one to add the software uses a combo box to select the user.
i need an easy (not complicated) way to update the drop downs after the user has been added to the database.
 
What are you using to populate the combo box? Are you using a method like mine above, a data control, etc....?

Swi
 
You could also add a reference to Microsoft DataList Controls X.X and add a DataCombo and also add an ADO Data Control to the form and bind the table to the DataCombo. Look into the properties of this control and you should be able to figure out what you need to do. Then in order to refresh the DataCombo just use something like this:

Private Sub DataCombo1_Click(Area As Integer)
Adodc1.Refresh
End Sub

This should take care of any updates that may occur.

Swi
 
First lets figure out what method you are using to connect to the DB. I assume when you say link you mean a databound control. What references are you using in the project, adodc? As Swi suggests a .refresh should work to update those controls.

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top