Having problem with combo box passing text into dest field.

J

jeff

Running on Access '02.
Can't figure out how to get my combo box to pass the chosen line of text
into the new field as text. It keeps showing up as a numerical number.
Any advice,
Thanks, in advance.
 
J

Jeanette Cunningham

Do you by any chance have 2 columns in the combo and the first column is a
numeric primary key?
If yes, then do it like this

Me.[NameOfTextBox] = Me.[NameOfCombo].Column(1)


The reference to column(1) will give you the second column of the combo
which is the text you see when you drop the list for the combo.
Combo column numbering is zero based (0 for the first column).


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
D

Daniel Pineault

Do you think you could give us a little to go on?

How is your combobox setup? What is its' Row Source? How are you currently
going about passing its' value to your textbox?

The more you give us, the more you'll get back!
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
J

John Spencer

Are you by any chance using a field that you have set up using the Lookup
Combobox option in the table. If so, that is your problem. While it SHOWS
the text on the screen, the actual value of the field is a number that
references a record in another table.

The best way to fix this is to remove the lookup by changing the Lookup of the
field back to text. Now, you can change the row source of a combobox on a
form to show the text by referencing the table that is storing the number
value and the text.

If you are using the lookup feature in the table, post back if you need
further help setting this up.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
J

jeff

Thanks for the reply's.
I'll try to simplify,

I'm tracking the different types of workshops that people attend.
I created a seperate database "List of Workshops" and will store the data
there.
This database has an ID field and another single "text" field (which stores
'date, name of workshop, and description' in it.
This probably isn't the best approach, but i'm still working out the kinks
with this.

Next, to populate this database i created a form "Admin Form: List of
Workshops" to input the data. And simply put in the data.

From there i would like to be able to go to each persons Profile Form page
(simple list of personal info) and have a "Drop Down Combo Box" showing the
workshops that have been offered. I will then choose the specific workshops
which they have attended. This means that I will have the option of choosing
one or more workshops for each person.

Once i choose their workshops, this data will be stored in its own field in
a different database called 'Profile' (this also has an ID field).

Then, on the same form which i chose their workshops, it will reflect those
choices in the 'Workshops Attended" field.

This in a nutshell describes what i'm trying to do.
My problem is, when i start choosing the workshops they attend from the
Combo Box, it is populating the "Workshops Attended" field with a number. I
want it to show the text from the combo box.
This is where i'm stuck.

Your help is appreciated.
Thanks in advance,
Jeff
 
J

jeff

Thanks for the reply's. I could use a bit more help!
I'll try to simplify,

I'm tracking the different types of workshops that people attend.
I created a seperate database "List of Workshops" and will store the data
there.
This database has an ID field and another single "text" field (which stores
'date, name of workshop, and description' in it.
This probably isn't the best approach, but i'm still working out the kinks
with this.

Next, to populate this database i created a form "Admin Form: List of
Workshops" to input the data. And simply put in the data.

From there i would like to be able to go to each persons Profile Form page
(simple list of personal info) and have a "Drop Down Combo Box" showing the
workshops that have been offered. I will then choose the specific workshops
which they have attended. This means that I will have the option of choosing
one or more workshops for each person.

Once i choose their workshops, this data will be stored in its own field in
a different database called 'Profile' (this also has an ID field).

Then, on the same form which i chose their workshops, it will reflect those
choices in the 'Workshops Attended" field.

This in a nutshell describes what i'm trying to do.
My problem is, when i start choosing the workshops they attend from the
Combo Box, it is populating the "Workshops Attended" field with a number. I
want it to show the text from the combo box.
This is where i'm stuck.

Your help is appreciated.
Thanks in advance,
Jeff
 
J

John Spencer

Perhaps the simplest fix is to hide the number column on your combobox.
ASSUMING the row source of the combobox has the ID and Details from the TABLE
"list of workshops" and it is displayed in that order, change the Column
Widths property to
Column Widths: 0;
That will hide the first column. You will still STORE the ID number but will
see the details (at least the first 255 characters) in combobox display.

Terminology, you probably have one database with multiple TABLES containing
the different entities (types of things) with their characteristics.

I would personally change the design of List of workshops to have the
following fields:
WorkShopID - Autonumber field
WorkShopTitle
WorkShopDate
WorkShopDescription
--- You could add additional fields for other types of information about
the workshop (instructor, room, etc.)

Next a Personnel table
PersonID - Autonumber field or some other thing that is unique to each person
and does not change
LastName
FirstName
PhoneNumber
--- and other relevant fields

Next a table WorkshopsAttended (Profile?) to hold which workshops were
attended by which person
PersonID
WorkShopID

If you have repeating workshops then this structure is incomplete and would
probably need some modification.
Workshops (would be a list of types of workshops) and the description
WorkshopID
WorkshopTitle
WorkshipDescription

WorkshopSessions would be a list of specific workshop sessions and would
parallel the structure given earlier.
SessionID
WorkShopID - number field pointing to a record in the workshop table
SessionDate
Location
Instructor
-- Other information you want recorded about the specific session

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
J

jeff

Hi John, and thanks for the input.

I seem to be getting closer with my efforts.
I now realize that my database is not set up optimumly, even though for the
most part it works for the simple stuff i'm doing. But as i get more into
higher options, i'm realizing i need to redo the structure of my database. I
will plan on doing this. Both to help myself and help others when it comes to
support questions.

Meanwhile, I can now see the text populate in the destination field
"workshops atended".
I'm very close to finishing this problem. I think?!

Now i need to be able to have multiple choices stored in that same field if
i chose multiple workshops from the combo box. This probably isn't too bad
of a change, i just can't see the forest through the trees.

Any input on this?
Thanks in advance,
Jeff
 
J

John Spencer

Well, first you cannot choose multiple choices from a combobox. A combobox
allows only one choice at a time.

You need to have multiple records to store the information. You usually do
this by having a form to show the individual and a SUB-FORM to show the
individual's workshops. The sub-form is based on a table like I described
earlier.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

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