Text box based on combo

ubgu3

Registered User.
Local time
Today, 18:14
Joined
Nov 21, 2006
Messages
13
I have searched and looked for this throughout the forum but can't find it.
I have a simple text box which I want to populate based on a combo box. The combo needs to display the table's field name and the text box needs to display the record. Is this possible?
Cheers,
Rene
 
Hi Ubgu3,

Not sure if this is what you are looking for but you can set a combobox to show the column heads. Thus when you click it, the Field value(s) are shown with the field name or whatever you call the field in the query the box is populated by. In this case, you would use the same name as the table the data comes from.

The text box would be populated in the after update event of the combobox using column reference. From memory it would be something like

mytextbox = mycombobox (0)

but as I am an amateur, I'd have to check that. Combobox columns are zero indexed which means the first column is 0, the second is 1 etc.

If you have difficulty with this, I can post all the required code snippets but probably won't be able to do this until tomorrow.

Hope this moves you forward.
 
The table the data is sourced from is called tblClientData. The columns are called strUpdateNov06 and strUpdateDec06. So each client has 2 columns in which data is displayed.
My form is called frmClientData. In this form I'm trying to create a combo box which will give the user the choice between strUpdateNov06 or strUpdateDec06 for that record. After selecting one, the contents will go to a text box. I think I can produce the after event but can't get the combo to display headings rather than records. I appreciate your help. Rene
 
ubgu3 said:
can't get the combo to display headings rather than records. I appreciate your help. Rene

Hi Rene,

I think I see your problem and I was not answering it the first time round.

The combo box can give you the field headings, as I described, but you can't select these as they are not data. What I think you want is to have a combo box with 2 selectable items which then go on to be used in a filter or search via code?

A quick play has shown me that you can set a combo box to show the fields in a table. Go to the data tab of the combobox properties and select 'Field List' as the rowsource type and the target table as the rowsource table.

See the attached database for the examples described.

Finally, if you are using dates as the field title in a table, you are limiting the database to a very narrow use. Have you thought about the structure of what you are trying to do?


Hope this ramble is of some useinmoving you forward. :)
 

Attachments

Users who are viewing this thread

Back
Top Bottom