Conditional Control Source Selection

G

Guest

here's my quandry....

let's say i hava an a2k app. let's say there's a form and the bound controls
that interest us are MR_Number (medical record number), IRB_Number (the
number of a clinical experiment on which a patient is enrolled),
RegisteredDate (the date on which the patient was registered on the
IRB_Number) and FollowUpDate (the next scheduled follow-up visit date), and
lastly a field called ECOG (don't worry about what it means---it's binary
e.g. Yes/No). i don't know if this aspect of the situation is all that
important, but the same MR_Number can appear on more than one IRB_Number (but
not at the same time--this would happen if a patient dropped out of an
experiment for some reason and then managed to be re-enrolled in a different
one later on).

let's say that the default value of ECOG's is "Yes" for each patient. when
it's 'Yes', then the control source for FollowUpDate would be a certain query
and that when it's "No" that the control source for FollowUpDate would be a
different query. in each case a date value would be entered into FollowUpDate
but it would be computed using slightly different follow-up schedules.

is this doable?
 
D

david epsom dot com dot au

In the Form "Current Event" and the ECOG "After Update Event"
you can put code to change the control source and/or rowsource
and/or default value for FollowUpDate.

Or you can write a query for FollowUpDate that refers to
Forms!myform!ECOG as a field or criteria.

(david)
 
L

Larry Linson

Ted said:
. . .
let's say that the default value of ECOG's is "Yes" for each patient. when
it's 'Yes', then the control source for FollowUpDate would be a certain query
and that when it's "No" that the control source for FollowUpDate would be a
different query. in each case a date value would be entered into FollowUpDate
but it would be computed using slightly different follow-up schedules.

Just for the record: Control Source of a Control cannot be a Query; it is
either a Field in the Form's RecordSource or an expression. That expression
can be a Domain Aggregate Function such as DLookup, however, which can
obtain its data by Querying the Table. But, a Calculated Control cannot be
bound to a Field in the RecordSource, so you would have to jump through a
hoop or two to save the value returned by a DLookup. And based on the ECOG,
you could change the DLookup in this Control's Control Source.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top