List Box shows -1 in the field on the form when it opens

G

Guest

I used loopupwizard for a field to list some items. When I created it I
selected that I would type in what was needed as these items are not in a
table. Typed in the items and saved etc.

Placed this field on my form, all ok so far.

I have a supplier form and when I click on a command button it opens a stock
form and opens it with the suppliers no. in that form in a field.

Now the field within the form for the items is displayed also, but this
contains in it when the form opens a -1 and if I then look at the list it
contains the items I typed in.

Why does it show -1, this is causing the form to not work as I want it
too... please can someone help me asap... pleeeeease!

thanks
 
G

Guest

It sounds more like you are using a combo box, not a list box. Is that what
you are using?

If the control is bound to a field in the form's RecordSource, it would show
whatever is in that field regardless of what is in your list. I suspect the
field that it is bound to is either a Yes/No or numeric data type.
 
G

Guest

Hi to Bill & Bob

I re-looked at this field and it is a combo box that was created to lookup
items:

required - yes
allow zero - no
indexed no - no
display - combo box
row Source - Value List
Bound Column - 1
Column count - 1
Column head - no
limit to list - yes

The row source shows the items as I typed in the list when created with
wizard first items:
"Accessories";"Clothing - Italian";"Clothing - Ballet";"Shoes" and so on

So not sure where the -1 comes from?

If you have any ideas please help... thanks again
 
G

Guest

Hi again

Bill - the only field that contains a -1 is the first field in the stock
table for the first stockname, so when I go to the combo box that looks at
all the stock items and lists them, it shows -1 for that field.

Bob - I have a stock table that contains stockNo, stockname
The stockNo is a autoNo and the primary key, the stock name is the combo box
that is a value list that I typed and contains:
Accessories
Clothing - Ballet
etc

The stock name field is Text type. When I look in this table the firt item
instead of shoes (which is what was chosen from the drop down list and is the
last item in the list) it shows -1.

I can not change the stockno to a text value as it has relationships with
other fields in other tables.

But it is not the stockno that is the problem, it is the stockname, why does
it keep changing the first stockname in the Stock table to a -1?

Still no clearer on this, any other suggestions as not got much hair left on
my head from all the pulling I have been doing...

Thanks
 
G

Guest

Saj

You just answered your own question. You said that the first name in the
stock table is "-1". If your combo box uses that field as its ControlSource
then that is what you will see regardless of what is in the combo list.

A bound combo box does 2 things. It shows what is in the field it is bound
to, and it provides a list to choose from to replace or fill that field.
 
J

John Vinson

But it is not the stockno that is the problem, it is the stockname, why does
it keep changing the first stockname in the Stock table to a -1?

Still no clearer on this, any other suggestions as not got much hair left on
my head from all the pulling I have been doing...

If the purpose of the combo is to *LOOK UP* items - that is, if its
AfterUpdate event has code to find a record - then its Control Source
must be left *blank*. It sounds like you have it bound to the
Stockname field, so that when you select a value from the combo it's
storing it in the table.

Remove the Control Source property of the combo and see if that helps.

John W. Vinson[MVP]
 

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