Combo Boxes and NotInList event

  • Thread starter Thread starter Stephen Glynn
  • Start date Start date
S

Stephen Glynn

Can anyone advise me on the best way to handle this in Access 2000?
Ideally I'd like, for example, to be able to set up the details for a
new client and set up an account for him on the same form that I'd use
to take an order for an client rather than have to set the details on a
frmRegisterNewClient and then take his first order (thus setting up a
new account) on a separate form.

I've got a combo box on my frmClientOrders that I use to select existing
clients by name every time I need to set up a new contract with a
client. The new client isn't going to be in the list of names my
combo box offers me, obviously. I set the combo box's Limit to List
property as "No". I now want a message box to warn me that this is a
new client (in case I've just mispelled his name) and to confirm I want
to add him to my client-list.

What do I do next to enter his details using frmClientOrders, send the
details back to tblClient, and then requery tblClient to get his
ClientID (the primary key of tblClient) which Access will need to create
a new entry in tblContracts so that I can then continue to enter details
of the particular contract on frmClientOrders?

Or is there an example in Northwind or any of the other sample databases
I could study and adapt?


Steve
 
Actually, you DO want Limit To List set to Yes. That will trigger the Not In
List event for the combo box, and you can insert what they've entered into
the source for the combo box.

Steve Clark's written an article about this at
http://www.advisor.com/articles.nsf/spec/clars01

Thanks. Sorry, I was confusing myself as to whether I wanted to limit
my entries to the list (which I didn't) and whether to limit them to the
list so as to trigger NotInList, which is what I needed to do.

I managed to find some useful articles on this in the Microsoft
Knowledge Base, if anyone else is puzzled about NotInList:

Microsoft Knowledge Base Article - 197526

Use NotInList Event to Add a Record to Combo Box

http://support.microsoft.com/default.aspx?scid=kb;en-us;197526&Product=acc2000

and the section on Dynamically Adding Items to a Combo Box in

"Creating Combo Boxes and List Boxes in Microsoft Access"
Tamra Myers

at

http://msdn.microsoft.com/archive/d...us/dnaraccessdev/html/ODC_accessdevForum1.asp

Steve
 
Back
Top