I have a main form that contains an UNBOUND combo box strictly for navigating thru subform records. The subform has an "Add New" button which runs a DoCmd.GoToRecord,,acNew event. This works exactly like it should.
The problem is that the mainform combo box stays on the previously selected item. Is there a way to clear it when adding a new subform record? In the OnClick event for the "Add New" button, I tried to use:
Me.Parent!cboSelMB.Text = Null 'doesn't like this
Me.Parent!cboSelMB.Value = -1 'clears but wont save
And I've even tried setting the focus to the main form and then directing the mainform to a new record, like this:
(pseudocode)
Forms!mainform!subform.SetFocus
DoCmd.GoToRecord , , acNewRec
Setting the value to -1 clears the combo box, but when I try to save the subform record, access gives me a "duplicate values" error. Since the combo box is unbound, why would it do this? Anybody got any ideas?
The problem is that the mainform combo box stays on the previously selected item. Is there a way to clear it when adding a new subform record? In the OnClick event for the "Add New" button, I tried to use:
Me.Parent!cboSelMB.Text = Null 'doesn't like this
Me.Parent!cboSelMB.Value = -1 'clears but wont save
And I've even tried setting the focus to the main form and then directing the mainform to a new record, like this:
(pseudocode)
Forms!mainform!subform.SetFocus
DoCmd.GoToRecord , , acNewRec
Setting the value to -1 clears the combo box, but when I try to save the subform record, access gives me a "duplicate values" error. Since the combo box is unbound, why would it do this? Anybody got any ideas?