Notinlist event for combo box 
Author Message
 Notinlist event for combo box

Hi all,
          I would like to add some extras data to the combo box  with the
following programming.  It seems to add data to the combo box but when I
restart the form after closing it. The added data has not saved in the combo
bos list.

        How to save the a new value in the text portion of the combo box?
Could anyone help me in this problem?
Thank you very much.

The program is :

Private Sub Colors_NotInList(NewData As String,  Response As Integer)
    Dim ctl As Control

    ' Return Control object that points to combo box.
    Set ctl = Me!Colors
    ' Prompt user to verify they wish to add new value.
    If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
        ' Set Response argument to indicate that data is being added.
        Response = acDataErrAdded
        ' Add string in NewData argument to row source.
        ctl.RowSource = ctl.RowSource & ";" & NewData
    Else
    ' If user chooses Cancel, suppress error message and undo changes.
        Response = acDataErrContinue
        ctl.Undo
    End If
End Sub



Tue, 02 Aug 2005 01:40:35 GMT  
 Notinlist event for combo box
Yeah, it won't work that way.  The reason is the RowSource resets everytime.
You have to base the combo box off a table, then add the new record into the
table.

Chris


Quote:
> Hi all,
>           I would like to add some extras data to the combo box  with the
> following programming.  It seems to add data to the combo box but when I
> restart the form after closing it. The added data has not saved in the
combo
> bos list.

>         How to save the a new value in the text portion of the combo box?
> Could anyone help me in this problem?
> Thank you very much.

> The program is :

> Private Sub Colors_NotInList(NewData As String,  Response As Integer)
>     Dim ctl As Control

>     ' Return Control object that points to combo box.
>     Set ctl = Me!Colors
>     ' Prompt user to verify they wish to add new value.
>     If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
>         ' Set Response argument to indicate that data is being added.
>         Response = acDataErrAdded
>         ' Add string in NewData argument to row source.
>         ctl.RowSource = ctl.RowSource & ";" & NewData
>     Else
>     ' If user chooses Cancel, suppress error message and undo changes.
>         Response = acDataErrContinue
>         ctl.Undo
>     End If
> End Sub



Tue, 02 Aug 2005 05:18:17 GMT  
 Notinlist event for combo box
Thank you for your explanation.

As I am a new user for the Access, could you please give me some reference
websites for how to do so?


Quote:
> Hi all,
>           I would like to add some extras data to the combo box  with the
> following programming.  It seems to add data to the combo box but when I
> restart the form after closing it. The added data has not saved in the
combo
> bos list.

>         How to save the a new value in the text portion of the combo box?
> Could anyone help me in this problem?
> Thank you very much.

> The program is :

> Private Sub Colors_NotInList(NewData As String,  Response As Integer)
>     Dim ctl As Control

>     ' Return Control object that points to combo box.
>     Set ctl = Me!Colors
>     ' Prompt user to verify they wish to add new value.
>     If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
>         ' Set Response argument to indicate that data is being added.
>         Response = acDataErrAdded
>         ' Add string in NewData argument to row source.
>         ctl.RowSource = ctl.RowSource & ";" & NewData
>     Else
>     ' If user chooses Cancel, suppress error message and undo changes.
>         Response = acDataErrContinue
>         ctl.Undo
>     End If
> End Sub



Tue, 02 Aug 2005 11:15:13 GMT  
 Notinlist event for combo box
Thx Chris
I got it.
^^


Quote:
> Thank you for your explanation.

> As I am a new user for the Access, could you please give me some reference
> websites for how to do so?


> > Hi all,
> >           I would like to add some extras data to the combo box  with
the
> > following programming.  It seems to add data to the combo box but when I
> > restart the form after closing it. The added data has not saved in the
> combo
> > bos list.

> >         How to save the a new value in the text portion of the combo
box?
> > Could anyone help me in this problem?
> > Thank you very much.

> > The program is :

> > Private Sub Colors_NotInList(NewData As String,  Response As Integer)
> >     Dim ctl As Control

> >     ' Return Control object that points to combo box.
> >     Set ctl = Me!Colors
> >     ' Prompt user to verify they wish to add new value.
> >     If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then
> >         ' Set Response argument to indicate that data is being added.
> >         Response = acDataErrAdded
> >         ' Add string in NewData argument to row source.
> >         ctl.RowSource = ctl.RowSource & ";" & NewData
> >     Else
> >     ' If user chooses Cancel, suppress error message and undo changes.
> >         Response = acDataErrContinue
> >         ctl.Undo
> >     End If
> > End Sub



Tue, 02 Aug 2005 11:24:25 GMT  
 Notinlist event for combo box

Quote:
> As I am a new user for the Access, could you please give me some reference
> websites for how to do so?

Van already gave you (on a similar or identical thread on another group...
try to post a given question to a single group, makes it easier for
everybody):
http://www.mvps.org/access/forms/frm0015.htm

Some great general references are:
The Microsoft Knowledge Base
http://support.microsoft.com/
The Access Web
http://www.mvps.org/access/
and the links at:
http://www.mvps.org/access/resources/othersites.htm#English

HTH,

Max
www.siliconpublishing.com



Tue, 02 Aug 2005 11:25:07 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Setting Combo box ListIndex initiates Combo box Click event

2. Combo Box "NotInList" events?

3. NotInList Event Issues

4. Problems with NotInList event

5. NotInList Event help

6. NotInList event

7. How do I simulate NotInList Event?

8. Combobox and notinlist event

9. enter data in a combo box based on value from another combo box

10. Limit subform combo box by selection in parent combo box

11. Want Access combo box to filter rowsource of another combo box

12. Populating a combo box from another combo box

 

 
Powered by phpBB® Forum Software