display a value based on a combo box

F

FirstVette52

The code for my form's Combo box [Combo_CompanyID]'s Select statement is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

....but when I use the standard format to set a text field equal to the Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I enter
=8+8 I get 64, but if I try to set the field equal to any field on the form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
J

Jeanette Cunningham

Hi FirstVette52,
access does #Name? when it can't find the field or column you ask for.

Have you set up the combo with 2 columns, check the dialog property for the
combo, format tab, and check the column count and the column widths.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
news:[email protected]...
 
D

Douglas J. Steele

The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
news:[email protected]...
 
F

FirstVette52

I used a Wizard to create the Combo box (in Access 2007). I included two
fields (see coding), the 'CompanyID' and 'Company' fields.

Column count in the Format/Properties is 2. Fieldwidth is set 1"; 3.5" with
a width of 4.5" for the list.

Both columns display in the Drop-down and the CompanyID is the visible value
in the field.

I tried using the Expression Builder and clicking the names into the
argument but it made no difference in the final outcome.

Thanks again for your trouble
--
FirstVette52


Jeanette Cunningham said:
Hi FirstVette52,
access does #Name? when it can't find the field or column you ask for.

Have you set up the combo with 2 columns, check the dialog property for the
combo, format tab, and check the column count and the column widths.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
F

FirstVette52

That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


Douglas J. Steele said:
The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
D

Douglas J. Steele

I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


Douglas J. Steele said:
The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
F

FirstVette52

2007?
--
FirstVette52


Douglas J. Steele said:
I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


Douglas J. Steele said:
The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
D

Douglas J. Steele

I'll try and remember to using 2007 and post back.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
2007?
--
FirstVette52


Douglas J. Steele said:
I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


:

The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my
ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select
statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to
the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When
I
enter
=8+8 I get 64, but if I try to set the field equal to any field on
the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
J

Jeanette Cunningham

When I have trouble with such a simple thing, I usually delete the combo box
and create a new one with the wizard. This usually fixes the problem. Hope
it works for you.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
2007?
--
FirstVette52


Douglas J. Steele said:
I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


:

The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my
ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select
statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to
the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When
I
enter
=8+8 I get 64, but if I try to set the field equal to any field on
the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
F

FirstVette52

Thx. It didn't work but I appreciate your time replying to this inquiry.

The combo box works fine, but the references to it (or any other field on
the form) in a text field do not. I can put simple arguments (i.e.: =8*8) in
the calculated field and get a correct outcome (64), but whenever I reference
a field I get the '#Name?' error (same error you'd expect to get for
referencing a field using a field name that doesn't exist).
--
FirstVette52


Jeanette Cunningham said:
When I have trouble with such a simple thing, I usually delete the combo box
and create a new one with the wizard. This usually fixes the problem. Hope
it works for you.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
2007?
--
FirstVette52


Douglas J. Steele said:
I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


:

The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my
ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select
statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to
the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When
I
enter
=8+8 I get 64, but if I try to set the field equal to any field on
the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
F

FirstVette52

I really like 07, but little nit-pickin' things like this keep popping-up in
it. It makes no sense to me that I should be having this problem. The
syntax for the field reference is correct and the combo box works fine, but
I've tried every trick in my bag to fix this problem and nothing is working.
My next step is to delete the entire form and start over. I hate to lose so
much work but it may wind-up being quicker. I don't mind searching for a
solution, I rather enjoy being able to fix & learn.

Thanks again for all your help.
--
FirstVette52


Douglas J. Steele said:
I'll try and remember to using 2007 and post back.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
2007?
--
FirstVette52


Douglas J. Steele said:
I should learn to read better!

Don't know what to say. It works fine for me.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
That's correct (zero-based, 0 is Column 1, 1 is Column 2). Column 2 is
desired, thus: '=[Combo_CompanyID].[Column](1)'

Thanks for your time
--
FirstVette52


:

The Column collection starts numbering at 0.

To get the content of the first column, you need to use .Column(0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my
ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select
statement
is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to
the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When
I
enter
=8+8 I get 64, but if I try to set the field equal to any field on
the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
C

Carl Rapson

Does it work if you reference it without the square brackets?

=Combo_CompanyID.Column(1)


Carl Rapson

"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
news:[email protected]...
 
F

FirstVette52

If I try to enter it without the square braces, ACCESS puts them in when I
click OK or click out of the field.

Thx for any ideas you might have
--
FirstVette52


Carl Rapson said:
Does it work if you reference it without the square brackets?

=Combo_CompanyID.Column(1)


Carl Rapson

"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 
F

FirstVette52

I changed the Combo box, thinking it had something to do with the way it was
made.

The new code assigned by the Wizard follows:

SELECT [Company].[CompanyID], [Company].[Company] FROM [Company] ORDER BY
[Company];
--
FirstVette52


Carl Rapson said:
Does it work if you reference it without the square brackets?

=Combo_CompanyID.Column(1)


Carl Rapson

"FirstVette52" <(My User name is Firstvette 52, too) firstvet52@(my ISP
E-mail provider is) netzero.com> wrote in message
The code for my form's Combo box [Combo_CompanyID]'s Select statement is:

SELECT Company.CompanyID, Company.Company
FROM Company
ORDER BY Company.[Company];

...but when I use the standard format to set a text field equal to the
Combo
box control

=[Combo_CompanyID].[Column](1)

to get the value in Column 2, I keep getting a '#Name?' error. When I
enter
=8+8 I get 64, but if I try to set the field equal to any field on the
form,
I get the '#Name?' error.

Any ideas will be greatly appreciated
 

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