adding a value to a table threw a combo box

R

Ran BD

guys,
I'm using a combo box to enable the user to select a value.
I would like to give the user the ability to update the combo box records.
any idea ?


thanks
 
A

Allen Browne

You can use the combo's NotInList event to add values to its lookup table,
provided the value being entered is the key value (i.e. not if the bound
column is zero-width).

Details in article:
NotInList: Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html
 
A

Allen Browne

Which line generates the error?

Comment out the error handler by adding a single-quote to the 2nd line,
i.e.:
'On Error ...

You may also like to double-check that the field named in the Control Source
of the combo is the correct field name for the lookup table.
 
R

Ran BD

Allen, just to check that we are on the same page:
the combo box is unbound i.e no control source.
the line that produces the error is :
rst.AddNew

and the error i'm getting is error 91 object variable or with block variable
not set.

thanks

Bye
 
A

Allen Browne

Right. Error 91 in that line means that rst has not been set.
The previous line assumes that the combo's RowSource property contains the
name of the lookup table, so it uses the name in the propety as an argument
for OpenRecordset. Does this line work for you?

The combo being unbound is fine, but the code does need the lookup table
specified in the RowSource of the combo.
 
R

Ran BD

can you tell me how do i check it out ?

Allen Browne said:
Right. Error 91 in that line means that rst has not been set.
The previous line assumes that the combo's RowSource property contains the
name of the lookup table, so it uses the name in the propety as an argument
for OpenRecordset. Does this line work for you?

The combo being unbound is fine, but the code does need the lookup table
specified in the RowSource of the combo.
 
A

Allen Browne

Ran, you will need to do some learning here for yourself.
It begins with opening the form in design view and looking at the properties
of your combo.
 
S

SUNBERRIES

I usually just go to the design view of the form,
then:
1.view the properties of the combo box (click combo box, then click
"properties" icon..or simply right click on the box then select
"properties" on the select option)
2.There are "Format/Data/Event/Other/All tabs there..Select tab
"Data".
3.Under Data tab will be "Control source", click on this line and drop
down menu comes out, select the field from the list, this will be the
field that you would want the input to go to.
4.Still under the same Data tab, click on the line of "Row Source Type"
, select "Value list".
5.Still under the same Data tab, type the value at the line of "Row
Source". Its gonna look something like this:
Row Source Apple;Bannana;Orange;Grapes (use semicolon to separate each
values)
6.If you want them not to input anything thats not on the list;
select "Yes" on the "Limit to List" line.

And there you go. Hope this helps.
 

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

Similar Threads


Top