Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert a show b in cell

Status
Not open for further replies.

engellou

IS-IT--Management
Aug 24, 2003
4
GB
I have a table with the following:
Code: Description
0101 Exam
0111 Extensive Exam
0121 Full case assesment
etc
i have a lookup command in another field in a diffrent table but want to be able to enter the code in that field and it should then show the description not the code.
any ideas
Cheers
 
It's difficult to make sense of your question, because you're using wrong terminology. A table field contains data; it can't contain a "lookup command", whatever that is. Are you perhaps talking about a DLookup() function call in the ControlSource property of a control on a form?

Please try again using correct terms. Otherwise we can only guess at what you want.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
engellou

If I understand you correctly, you have a combo box that queries another table. The combo box is displaying the description, ie., "Exam", but you want to see the code "0101".

If this is your problem, then look at the format features. For column width, the width of the first column is probably set to 0". Change this to 0.5" or 0.7" (using your examples as provided).

If you are unsure how to get to the format tab, edit the form in design mode, and select the combo box. If the properties popup is not visible, right click on the field and select "properties" from the menu. Format will be on the first tab.

Richard
 
what i have is a combobox that queries another table and is displaying both the "code" and "description" fields. i want to be able to enter the eg "0101" into the combo box and it should then show "Exam" in the same combobox

Thanks Louis
 
Louis

Sorry for not responding sooner.

Two thoughts...
- It may be easier to use an unbound combo box. And change the source at the code level. You will still need to have the linking data that is bound somewhere else on the form (but it can be invisible).
- I have not done this but at the coding level, it may be possible to change the column widths.
Something like...
Combo Box name "SelectCourse"
After Update event

dim strQ as string
strQ = chr$(34)
me.SelectCourse.ColumnWidths = "0" & strQ & ";1" & strQ

Personally, I would create two combo boxes, or one combo box and one text box.

The user enters the course number in the first combo box field. The course is displayed in the second field. This second field will not allow the user to change (because the user uses the course number to select the course).

Richard

 
how would i set up a text box to be controlled by the combobox and give a value in a diffrent field ie to show the description when the code is selected in the combobox?
 
Louis

With a bit of code. Although only one field is displayed in the combo fox, all fields are acessible.

Say the "SelectCourse" combo box uses the following for the row source...
"select CourseCode, CourseDesc from tblCourse order by CourseCode"

The course code is in the first column, the description in the second. The course code is what is displayed.

Using the "AfterUpdate" event

if not isnull(me.selectcourse) then
'Column numbering begins at 0, column 1 is the 2nd column
me.txtDesc = me.selectcourse.column(1)
end if


You would probably need to add this code to the On Current record event as well.

If you two combo boxes, and you play with the column widths, you would not need any code.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top