OnNotInList property to automatically add a new value to a list.

G

Guest

There are several places in "Access Help" where they say:

.......NotInList event occurs. You can use this property to automatically add
a new value to a list.......

BUT THEY NEVER TELL YOU HOW!

So Here's my dilemma...

I have a form in which I'm defining components used in our projects.
One of the components fields uses a combo box with a list of items to choose
from.
This list is derived from a table called IOCARDS.

Sometimes the component I need to add isn't in the list.
I want to type the name of the new component into this combo box and have it
automatically added to the list for future use. Sooooo.....

I need to build an expression using the "OnNotInList" trigger to add the new
component name to the list AND the table "IOCARDS"

I've been trying to use the examples shown at:
http://www.pacificdb.com.au/MVP/Code/NIL.htm

but I keep getting the error "User-defined type not defined"
on the line "Dim db As Database"

I'm LOST. I'm not a programmer. ANY help will be greatly appreciated.

Thanks in advance.
Ren
 
B

Brian Bastl

Hi Ren,

You probably need disambiguate your reference. Open your VBA editor by
typing Alt+F11. On the menu bar, click on tools | references. Do you have a
check in the box next to Microsoft DAO 3.X Object Library and/or Microsoft
ActiveX Data Objects 2.X? If so, and you don't need ADO 2.X, uncheck it.
Otherwise, you'll have to disambiguate your db reference by explicity using:

Dim db as DAO.Database

Post back if that doesn't work.

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top