Updating a combo box from values entered on a separate form

Webby

New member
Local time
Today, 07:49
Joined
Jul 5, 2007
Messages
7
Hi

Can someone please advise what to do with the following problem:

I have a main form in which sits a subform which has a combo box . Behind the combo box is a table. If the required value is not on the table, the user can choose to open a NEW form (from the subform via a button) which can be used to add a new record to the table. When this record is saved and the form closed, i expected to see that the combo box on the sub form (which is also pointing to this table) to be updated with the new values the user has just entered. This is not happening, and i think its because i need to refresh or requery the combo box in some way. i have used the requery method against the save button on the form for adding the new records, and i have tried similar things to try and get the combo to refresh and it wont. does anyone know how to get round this? i am sure it will be something stupid i am missing...

thanks

Webby
 
In the code that closes the other form, use:

Forms!YourMainFormNameHere.YourSubformCONTAINERNameHere.Form.YourComboBoxNameHere.Requery

And this might help you with how to use subform syntax:

1. When you are dealing with subforms, you are actually dealing with two parts - the subform CONTAINER (that which houses the subform on the main form) and the subform itself.

2. The subform and subform container can be named the same, but are not necessarily so. You need to check before writing the code. If they are the same then it simplifies things but it doesn't really matter if it is, or isn't, because you just have to refer to the container.

3. When you are doing things like requerying the subform, you are not really requerying the container, as it doesn't have a requery method, but the subform itself does. So, when you are referring to a property, or method, on the actual subform (not the container), you need to have the subform container name and then .Form. between the container name and the method, or property, so Access knows you want to refer to the form's method or property and not the container's method or property.
 

Users who are viewing this thread

Back
Top Bottom