Conditional entry in textbox

aziz rasul

Active member
Local time
Today, 19:12
Joined
Jun 26, 2000
Messages
1,935
On a form I have a combo box and a textbox.

As I highlight entries in the combo box, I want the textbox to automatically show a statement. For example, if I have the following items in the combo box: -

Report1
Report2
Report3
etc.

I want the textbox (for say when Report1 highlighted) to say: -

This report will give cost savings on a like for like basis and has been instigated by Joe Bloggs.

As I move up and down the combo box items the textbox entries should change. When the correct entry appears in the textbox, I can then select that item from the combo box.

Any help would be appreciated. Access 2000.
 
Create a table with the report names and descriptions. Make the query that powers the combo include the description field.
Create an unbound textbox on the form. On the AfterUpdate event of the combo, set the value of the textbox

ie
Code:
Private Sub YourCombo After_Update()
me.NameofTextbox = Me.NameOfCombo.column(DescriptionColumn)
End Sub
remember that combo colums start at 0
 
It's not the AfterUpdate event that I'm concentrating on. What I'm concentrating on is when I have entered the combo box and all the reports are visible and I am highlighting them as I move the cursor up and down.
 
I dont think moving the mouse over items in a cbo can have any sort of code that will trigger or can trigger something else. If there is I want to see this in action also!
 
I take that back. I just used the OnMouse Move event to both highlight the text in the cbo and made the foreground of a text box change. So, the answer is yes! It would take a series of if statements to do this as far as highlighting the other text boxes as you want.
 
Follow Fizz's advice, just add the second field to the combo, set the number of columns to display to two, set the column widths to suit
 
And use the combo's Change event...

Code:
Private Sub ComboX_Change()
   Me.TextBoxName = Me.ComboX.Column(1)
End Sub

Note: Yet this only works on my PC when using the "Arrow" keys to move from one entry to another in the combo. You could always use a listbox...

Regards,
Tim
 
Last edited:
I don't think I can achieve what I'm EXACTLY trying to do. However I have tried using the advice on this thread and got it to work when I selected a value in the combo box. Both AfterUpdate and Change events work.

Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom