Update form field from table

Psiren17

Registered User.
Local time
Today, 12:48
Joined
Nov 18, 2005
Messages
31
I have a "model line" drop down box on a form. This is comes from the main table. When i set up the main table i set it to lookup the options in another table.

The problem i have is that when i add new model lines to this table they dont show up in the form drop down menu unless i delete the field from the form and re-add it. This obviously means i have to redo the tab order etc. I want my uninformed users to be able to add new model lines to the table and have them automatically show up in the drop down box - is there any way to do this?
 
Hi, thats great but i dont really want the user to be able to add any old text (and believe me they will!) by using this method. Ideally i would like the manager (also an uninformed user) to be able to open a simple form and enter a new model name which then goes into the table. I have all this set up fine but the new entries dont show up in the combo box on the form unless i go and delete and replace the combo box.

Is there any other way to do this? for example is there any code which can refresh a combo box when a form is opened?
 
How about just requerying the cbo in the GotFocus or OnEnter events?
 
The OnEnter might work.... what code would i use to do it though?
 
Don't worry - i figured it out!!

Thanks a LOT for your help.
 
In case anyone else needs to know....

Private Sub Model__Enter()

Requery
Exit Sub

End Sub
 
Beware of defining lookups at table level. They will get in your way sooner or later. Quite why Microsoft included them, I don't know.
 
The OnEnter might work.... what code would i use to do it though?

Just so you are aware - the ON ENTER event doesn't mean when you hit the Enter key, it means when you enter the control.
 
In case anyone else needs to know....

Private Sub Model__Enter()

Requery
Exit Sub

End Sub
I thought you just wanted to renew the ComboBox values. That would be:
Code:
Private Sub Model_Enter()

   Me.Model.Requery

End Sub
No exit Sub is required.
 

Users who are viewing this thread

Back
Top Bottom