The report is based on a cross tab query that is based on a select query.
The select query uses five tables from our tracking data base (created by an outside programmer): Client; ClientExam; Exam; ClientLocation; Location. The last two are used only for sorting and grouping the report.
Client is the main table and contains, as you would expect, information on each resident current and past.
ClientExam stores infomation on a variety of medical issues: Height; weight; IQ test results (not medical but its here); various innoculations; and, what I am interested in, various medications. The table is set up as ExamID (Autonumber), ClientID (foreign key), ExamID (foreign key), Results (text for Height, weight, etc), ExamDate (of exam or innoculation or administration of medication) and Notes. Every time a resident's height or weight is taken or a shot is given the data are entered into the ClientExam table with ExamID coming from a lookup based on the Exam table.
Exam is, essentially, a Lookup table that provides the description of the various Exams.
The select query pulls Location from the ClientLocation/Location tables, Name from the Client table, ExamID and ExamDate from the ClientExam table and Exam Name from the Exam table. Results are ordered by (Location), Client Name, ExamID, ExamDate. The query is limited to current residents and only those ExamIDs of the medications necessary for the report.
The crosstab query is based on the select query and is organized as follows:
Field Row Total Row Crosstab Row
Location Group By Row Heading
Name Group By Row Heading
Exam Name Group By Column Heading
Exam Date Last Value
When the report was created at least one resident was receiving at least one of each of the medications in question. At this point no current resident is receiving Lamictal (the offending med) but this could change with the next admission. The report is set up with each of the seven medications in the detail band (based on the original results of the crosstab query).
Now, since the crosstab does not return a column for Lamictal, I receive the message ". . . does not recognize "Lamictal" as a valid field name or expression."
Probably that was a lot more detail than necessary but you did asked for it. (I hope this is what you were asking for.)
As I said above, what I think I need is the syntax for referencing the results of the query in the Report Open or Format events to determine if Lamictal is in the results. And then some idea of what to do with that information to prevent the error from aborting the report.
I have been trying a number of things but haven't met with anything that works.
I really appreciate your help Jim, it's been invaluable. [sig]<p>Larry De Laruelle<br><a href=mailto:larry1de@yahoo.com>larry1de@yahoo.com</a><br><a href= > </a><br> [/sig]