Combo box - not in the list event (1 Viewer)

key

Registered User.
Local time
Today, 03:20
Joined
Jun 19, 2002
Messages
45
Hey Access-Friends,

I've got a combo box on my form and an event 'not in the list'. So, the user goes to a second form adds new color and clicks on 'Save'.
What I'm trying to do is I want to requery the combo box in order to show the new color in the box. But it doesn't work... :-(

There is a run-time error '2118' which says? 'you must save the current field before you run the Requery action'. Well, the record has been saved.

Any suggestions guys? Many thanx in advance,

Key
 

scottfarcus

Registered User.
Local time
Today, 09:20
Joined
Oct 15, 2001
Messages
182
In the OnEnter event of the combo box, enter:

cboColor.Requery

This assumes that the combo box is named cboColor.
 

llkhoutx

Registered User.
Local time
Today, 03:20
Joined
Feb 26, 2001
Messages
4,018
You're obviously not adding the new value correctly. One does not have to requery a combo box to get values added with the notinlist event.

Be sure that your setting

Response = acdataerradded

to indicate that a value have been added to the rowsource recordset, and

Response=acdataerrcontinue, if you're not adding the value.
 

key

Registered User.
Local time
Today, 03:20
Joined
Jun 19, 2002
Messages
45
what do you mean?

I'm sorry, I'm not sure if I understand your point.... What do you mean by saying "respnose"? Where I should set it?

Thanx

Key
 

llkhoutx

Registered User.
Local time
Today, 03:20
Joined
Feb 26, 2001
Messages
4,018
"Response" is one of the arguments of the "YourComboBox_NotInList" procedure created with the "NotInList" event.
 

llkhoutx

Registered User.
Local time
Today, 03:20
Joined
Feb 26, 2001
Messages
4,018
A requery is not necessary. Just set Response=acDataErrAddedd in the form that triggers the NotInList event, for examble

Private Sub YourComboBox_NotInList(NewData as string, Response as Integer)

your code -

Call NewForm - to add your data to the rrowsource for the combo box

Response = acDataErrContinue

Exit Sub
End Sub
 

Users who are viewing this thread

Top Bottom