updating combo box with new values

clares

Well-known Member
Joined
Mar 14, 2002
Messages
557
Hi There

I wonder if anyone can help me. I have a combo box that I want to populate with a new value(s) if the item is not in the list for the user. I am using the code below.

The problem is on the double click event, i open the relevant form allowing the user to create a new record, say staff member and close the form with a save. On closing the form the new entry appears in the combo list for the user to select, however, if the user wants to select another value (from the same combo box), the new value does NOT appear. What is it that I'm doing wrong or ommitted! Please help!

Code:

Private Sub StaffID_DblClick(Cancel As Integer)
Dim Response As String

Response = MsgBox("You are about to add another record to the list. Are you sure you want to do this!", vbYesNo, "Creating another staff member")

If Response = vbYes Then
DoCmd.OpenForm "frmStaff"
DoCmd.GoToRecord , , acNewRec
Forms![frmStaff].Refresh
Else
End If
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,221,537
Messages
6,160,402
Members
451,644
Latest member
hglymph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top