Update Combo Box Based on SubForm

Scorpion

Registered User.
Local time
Today, 23:48
Joined
Jun 15, 2000
Messages
35
What I want to to do is when I am entering a "Site Name", if the site entered is not in the list a separate form pops up which allows me to enter the information. After I have entered and closed this other form it returns me to the original form. When I try to enter the new value, the record cannot be found. When I close the form and reopen it the new record is now available. I want Access to automatically update the comb box so I do not have to open & close the form. I ahev tried to requery using VBA but each time I do it tells me I need to save the current field first. Can anyone give me some hints on solving this problem.
 
I basically do the same exact thing on my forms and the docmd.requery does the job fine, but Ill post what I do anyway.
In the OnEnter event for the combo box I put
-----
Private Sub comboboxname_Enter()
On Error GoTo cbomanager_Enter_Err

DoCmd.Requery "comboboxname"

comboboxname_Enter_Exit:
Exit Sub

comboboxname_Enter_Err:
MsgBox Error$
Resume comboboxname_Enter_Exit

End Sub
-----

HTH
Rpb
 
I entered the following:

Private Sub Site_Name_Enter()
On Error GoTo cbomanager_Enter_Err

DoCmd.Requery "Site Name"

Site_Name_Enter_Exit:
Exit Sub

Site_Name_Enter_Err:
MsgBox Error$
Resume Site_Name_Enter_Exit

End Sub

When I enter into the combo box, the VBA screen pops up with an error message stating : Compile Error: Label Not Defined

Any tips.
 
Private Sub Site_Name_Enter()
On Error GoTo cbomanager_Enter_Err <--CBOMANAGER should be Site_Name also

that was my fault I forgot to change cbomanager to comboboxname.

sorry
 
I tried to copy your code, but it didnot work. The list in my combo box is a value list which I entered in row source. Could this be the reason why it didn't work? I don't have a subform. Everything is on 1 form.

[This message has been edited by lamha (edited 06-27-2000).]
 
Not sure exactly what you are trying to do. Explain.

[This message has been edited by Scorpion (edited 06-27-2000).]
 
I have a form that contain PersonName and Location. I made a combo box for Location. I selected Value List for Row Source Type, and then I typed in Row Source property 3 list items for that combo box.
What if a person is not from those 3 locations. I want the user to be able type in a new location, and the combo box also update its list.
 

Users who are viewing this thread

Back
Top Bottom