ComboBox Question

B

bladelock

I place a comboBox, (which get data from a table) on a form for the user. It
works fine, however, On the form is shows the proper doctors name on the
table it shows the number of the record that was select and not the doctors
name. When I print a report only a number shows up and not the name. When I
go back to the form the name appears instead of the number. How can I make
this work?

The combobox has this:
rowsource type: Table/Query
rowsource: SELECT DOCTORS.Numbers, DOCTORS.NAME FROM DOCTORS;
bound column: 1
 
N

NetworkTrade

I believe that the doctor field (in its table) is actually a look up field.
Look at its table properties to determine. And this field is set to hold the
numeric value from its source table.

Why it some times shows name/text and other times shows the number - is a
function of Microsoft logic and can be somewhat confusing. (For this reason
some designers never use the lookup field feature.)

You can redesign those tables. Or if that is too painful... for the report
you can generally modify the underlying query to add the table with the
doctor's name as a text box and add that to the report...
 
A

Al Campagna

bladelock,
Your combo should use the doctor's table key field, along with the
doctor name.
Is Doctors.Numbers your unique key field for each doctor record?
I'll assume yes...

I'd suggest you not use the name Numbers. It's a reserved word. Try
something like DoctorID.
Also, avoid the name "Name". It's an Access property, and will cause
problems.
Try DoctorName instead.

Setup your combo (ex. cboDoctorID) like this...
Columns = DoctorID and DoctorName
Column Count = 2
ColumnWidth = 0" ; 2"
List Width = 2"
Bind the combo's ControlSource to the DoctorID field of your table.

What this setup does is...
It only displays a list of doctor names for easy selection.
When a doctor name is selected, it stores the DoctorID in your table,
but still displays the doctor name.

I have a sample A97 and A2003 file on my website (below), called Combo
Populates Multiple Fields, that demonstrates the above setup.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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