tool-tip-like update event procedure based on field name

kballing

I do stuff
Local time
Today, 03:59
Joined
Nov 17, 2009
Messages
51
For a research study I'm writing a form to screen possible subjects based on various criteria stored in a table. The table essentially has three columns: field_name, Criteria_short, and Criteria_long. The form is pretty busy so there is only space for the short description of the field.
e.g. "No history of coronary artery disease."

I want to include an OnClick or OnGotFocus event for each checkbox field that changes a textbox to show the long description of the criteria.
e.g. "No coronary artery disease within 5years, evidence by cath procedure, stress test, ECG . . . "

Problem 1: the tool-tip-text property isn't big enough to hold the long descriptions.

Problem 2: I plan on using the same code for other studies with different criteria. I have code that iterates through each criteria in a table that creates a checkbox with the appropriate short description. I don't want to 'hard code' each event procedure for each text box (about 50 criteria). As I iterate through each criteria I want to set the OnClick event procedure to set some text box to the long description. The following do not work:
Code:
For Each cont In Me.Controls
If cont.ControlType = acCheckBox Then
'assume that long_desc is the appropriate long description text
'directly update the textbox
cont.OnGotFocus = "= SomeTextBox = '"& long_desc &"'"
'use a function to update the textbox
cont.OnGotFocus = "= SomePublicFunction('"& long_desc &"')"
end if
next cont
It seems that I can only set the event property to built in functions.

How can I generate the event procedures with a for loop?
 
More info. If I do cont.OnGotFocus = " = SomePublicFunction('blah blah blah')"

where:

Public sub SomePublicFunction(text as string)
Sometextbox = text
end sub

Give this error:
"The expression you entered has a function name that Microsoft Office Access can't find."
 
Ok, figured it out. My problem is I was trying to call a subroutine from the event procedure property. I guess you have to have a function, not a sub.
 
Yes, that is true.
 

Users who are viewing this thread

Back
Top Bottom