Re: Adding a new entry to a linked table

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You must be using Access 2000 or 2002. By default, those two versions of
Access do not include a reference to the DAO library.

With any code library open, select Tools | References from the menu. Scroll
through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library. Select it (put a check beside it), then
back out.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Secret Squirrel" <secretsquirrel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:E45EC22C-3F65-4EB7-A462-4F773BEBFBA5@xxxxxxxxxxxxxxxx
> I tried to use the instructions you pointed out but I am getting an error
> code from the module. When I try and add a new entry I get this error from
> the module:
>
> Compile Error: User-defined type not defined
>
> And then it points to this line in the module code:
> Dim rst As DAO.Recordset
>
> "Allen Browne" wrote:
>
> > You can programmatically add the new name to the Customer table in the
> > NotInList event of the combo, but only if the combo's bound column is
> > visible (not if it is zero-width, so that the entry being typed is not
the
> > key value.)
> >
> > Details in this article:
> > NotInList: Adding values to lookup tables
> > at:
> > http://allenbrowne.com/ser-27.html
> >
> > If you need to enter more than one field, or the bound column is
zero-width,
> > use the DblClick event of the combo to OpenForm so the user can complete
the
> > new entry. Then in the AfterUpdate event of that form, Requery the
combo,
> > e.g.:
> > Forms![Form1].[Combo1].Requery
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > Tips for Access users - http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> > "Secret Squirrel" <secretsquirrel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> > message
> > news:2094CBFA-5C78-4F59-9EC3-75666CC0D472@xxxxxxxxxxxxxxxx
> > >I have an order entry form that has a field for the customer name. The
> > > customer name is kept in a separate table from the orders. I want to
have
> > > my
> > > users be able to select a name from a list and if it's not already in
the
> > > table then have it automatically add it using a macro. The field is
set up
> > > as
> > > a combo box right now so the users can pull down the list and see if
it's
> > > there, if it is then they select it, and if not then I want them to be
> > > able
> > > to type it in and then a macro will automatically run to add it to the
> > > customer table. Can this be done?
> >
> >
> >


.



Relevant Pages