[AccessD] NotInList Problem

John Frederick j.frederick at att.net
Tue Apr 22 08:01:31 CDT 2003


This is one of those problems that calls for a standard reusable solution,
but gets resolved over and over.  Stuart's solution works if the single
value from the combo box is all you need to create a new record.  In the
more general case, when more data is needed, you pop up a form and when the
form is closed and control returns to the NotInList event code, requery the
combo box.  Alternatively, if the combo box is bound to the AutoNumber field
in the RecordSource, you could open a recordset, Add a blank record, read
out the new AutoNumber after the AddNew, save it, call the form and after
the form closes, plug the saved AutoNumber into the combo box to set it to
the new record without another search.  All the Getz/Litwin/etc. books have
sample code.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Tuesday, April 22, 2003 6:28 AM
To: David & Joanne Gould; accessd at databaseadvisors.com
Subject: Re: [AccessD] NotInList Problem


On 22 Apr 2003 at 18:33, David & Joanne Gould wrote:

> I am trying to add a new record into a table when the user types an
> entry into a combo box that triggers the NotInList event. My problem
> is trying to use the text that was typed in. How do I find it
> prgramatically?
>
> The table only has two fields: Autonumber (PK) and a descriptive text
> field.
>

Look at the NotInList Event:

Private Sub Combo0_NotInList(NewData As String, Response As Integer)

NewData contains the newly entered string.
Response is a flag which defines how the event is handled after your
code has been executed in the Sub.

Just insert  NewData  into the table and set Response to
acDataErrAdded








--
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System
Support.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list