Query/Form

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

I have a form that has three unbound fields that by
changing the values, changes the result of the form. I
like this form very much and would like another similar to
it. I have tried to copy it to redo it for the new query
criteria but I get an error message that reports that the
code is "an invalid name. Make sure that it does not
contain invalid characters or punctuation and is not too
long." The following is the code:

SELECT *
FROM (PATIENTS LEFT JOIN DIAGNOSES ON PATIENTS.CDC_NBR =
DIAGNOSES.[CDC#]) LEFT JOIN [Schedule Details] ON
DIAGNOSES.DATE = [Schedule Details].ScheduleDate
WHERE ((([DIAGNOSES].[Diagnoses])=[Forms]![Diagnoses Look-
up]![cboDiagnoses]) AND (([DIAGNOSES].[TypeOfTest])=
[Forms]![Diagnoses Look-up]![cboTypeOfTest]) AND
(([DIAGNOSES].[Test Results])=[Forms]![Diagnoses Look-up]!
[cboTestResults])) OR ((([DIAGNOSES].[Diagnoses])=[Forms]!
[Diagnoses Look-up]![cboDiagnoses]) AND
((DIAGNOSES.TypeOfTest)=[Forms]![Diagnoses Look-up]!
[cboTypeOfTest]) AND (([Forms]![Diagnoses Look-up]!
[cboTestResults]) Is Null)) OR ((([DIAGNOSES].[Diagnoses])=
[Forms]![Diagnoses Look-up]![cboDiagnoses]) AND
(([DIAGNOSES].[Test Results])=[Forms]![Diagnoses Look-up]!
[cboTestResults]) AND (([Forms]![Diagnoses Look-up]!
[cboTypeOfTest]) Is Null)) OR ((([DIAGNOSES].[TypeOfTest])=
[Forms]![Diagnoses Look-up]![cboTypeOfTest]) AND
(([DIAGNOSES].[Test Results])=[Forms]![Diagnoses Look-up]!
[cboTestResults]) AND (([Forms]![Diagnoses Look-up]!
[cboDiagnoses]) Is Null)) OR ((([DIAGNOSES].[Test Results])
=[Forms]![Diagnoses Look-up]![cboTestResults]) AND
(([Forms]![Diagnoses Look-up]![cboTypeOfTest]) Is Null)
AND (([Forms]![Diagnoses Look-up]![cboDiagnoses]) Is
Null)) OR ((([DIAGNOSES].[TypeOfTest])=[Forms]![Diagnoses
Look-up]![cboTypeOfTest]) AND (([Forms]![Diagnoses Look-
up]![cboTestResults]) Is Null) AND (([Forms]![Diagnoses
Look-up]![cboDiagnoses]) Is Null)) OR ((([Forms]!
[Diagnoses Look-up]![cboTestResults]) Is Null) AND
(([Forms]![Diagnoses Look-up]![cboTypeOfTest]) Is Null)
AND (([Forms]![Diagnoses Look-up]![cboDiagnoses]) Is
Null));


I have poured over this for hours and although there is
something wrong it looks much like the code I copied.
Please take a look and advise me.

Thanks,

Dennis
 
Problem fixed. I do not know why but I made a new form and
pasted this code into it and it works as designed. I thank
any of you who gave a solution your time.

Thanks,

Dennis
 
Back
Top