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!

Open Form with Command Button; Update Combo Box 1

Status
Not open for further replies.

darrelhawes

Technical User
Jul 15, 2003
24
0
0
US
I'm working on a data-entry form which has several combo boxes linked to tables. In most cases, I have restricted data entry to the lists in the combo boxes (pulled of course from the underlying tables). I have set up command buttons next to some of the combo boxes in order to add new records. When the button is depressed, another form pops up which the data entry person can use to review the existing records in that table and/or add a new one.

For the purposes of discussion, I'll call the main form "Book" with a table linked to the combo box "Author".

Here's my problem: after adding a record and closing the "Author" form, the new record doesn't show up immediately on the combo box of the "Book" data entry form. If I close the "Book" form and re-open, the new record does appear. Of course that defeats the purpose of including the command buttons.

In summary, how can I force the new record to appear in the "Author" combo box within the "Book" form without closing and re-opening the "Book" data entry form?

Darrel
 
the command need is requery.

me.combobox0.requery

forms can be requeried or controls.

rollie@bwsys.net
 
try the command button you describe above.

rollie@bwsys.net
 
I looked at the properties for the command box and can't figure out where to add the statement me.combobox0.requery.

I have discovered that if the user selects Records-Refresh it will update the list but I would like it to be an automatic process.
 
Look at the code 'under' the command button. When you click on properties and 'events' you will see a number of events. Usually the one you want is click and double clicking on the three dots to the right and on code, you will get the VB code page.

Between the

private sub command0_click() and exit sub

you place the command me.combobox0.requery

You understand that the names must be the names of your controls - ie the combo and the command controls.


rollie@bwsys.net
 
if these tips work, folks, do not forget to click the stars for your tipsters
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top