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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to evaluate a combobox to return a value to a field 1

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
I am trying to return a value to a field, based on the selection from a combobox. In particular I would like to:
Based on the selection in a combobox (type of medical legal case ie. State QME) return a value of whom should be served the reports (based on the selection, which parties should receive the reports) Any ideas?
 
Number2,

Use code attached to the after update property of the combo box to set the value using If statements e.g.:
Code:
dim strComboText as string

set strComboText = Me![MyCombo].value

If strComboText = "CaseType1" then 

Me![MyTextBox].value = "ReportsTo1"

If strComboText = "CaseType2" then 

Me![MyTextBox].value = ReportsTo2

etc...

Else: Me![MyTextBox].value = ReportsTo3

End If

Hope this helps Robbo ;-)
 
I have an idea, but its just like the multi column listbox kind of thing. The Combobox's columncount should be set to 2, columnwidths 1";0". Set the RowSourceType to "Table\Query" and then create a query that will have the medical report choices (maybe a lookup table should be made for this) in the first column and the ReportsTo in the second (hidden column).

in the combobox's afterUpdate() place this code:

with me
if not IsNull(.MyCombo.value) or (.MyCombo.value <> &quot;&quot;) Then
'Push the value of the second column into the textfield
.Mytext.value = .MyCombo.Column(1)
end if
end with

That should work well for your situation.


Hope that helps

Bob
 
Robbo, I am trying to make that idea work. I am running into trouble. Can you be a little more specific as to the code? Also how do I call up the response feild.
 
Tanks Bob, that works great, in fact it is a great solution as it allows for easy use of a form to update the &quot;sendto&quot; and &quot;type of case&quot; selections as laws, and rules change. Thanks so much for the simple solution. This board and all the great help are invaluable!
Dan
 
Bob, one last thing; it seems that the feild which displays the resultant text disappears after closing the form. How can I get the feild to remain/or update automatically? Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top