G
Guest
Hello
I'm trying to run a SQL query that contains a nested query which takes a
value from a forms combobox
SELECT PATIENT_DETAILS.PAT_NO, PATIENT_DETAILS.PAT_ID,
PATIENT_DETAILS.PAT_NAME, PATIENT_DETAILS.PAT_ADDRESS,
PATIENT_DETAILS.PAT_CITY, PATIENT_DETAILS.PAT_COUNTRY,
PATIENT_DETAILS.PAT_GENDER, PATIENT_DETAILS.PAT_DoB, PATIENT_DETAILS.PAT_ZIP,
PATIENT_DETAILS.PAT_PHNUM
FROM PATIENT_DETAILS
WHERE ((([PATIENT_DETAILS].[E_ID])=(SELECT [ePATIENT].[E_ID] FROM [ePATIENT]
WHERE [ePATIENT].[E_CHRONIC_DISEASES]=[Forms]![Search]![cmbdisease])));
i want only the listed columns after the first select statement from my
patient_details table,
but it must only show the fields where the E_ID column in my patients
details table is the same as the E_ID column from my ePATIENT table
where ePatient.E_CHRONIC_DISEASES is equal to the value passed from the
combobox called "cmbdisease" from the form called "Search"
when i run the query i am using a button to load it from my search form, so
the combobox is selected and the search form is present once i click the
button to load the query.
what happens is it returns all the columns i requested from the table i
requested but with no values.
I checked by removing the 2nd select statement and replacing it with an E_ID
number which does exhist, and this works it return the right field values
associated with the number
but with the select statement i returns all columns with no values.
so to narrow the search down theres obviously something wrong in the 2nd
select statement.
Please help, if possible
I'm trying to run a SQL query that contains a nested query which takes a
value from a forms combobox
SELECT PATIENT_DETAILS.PAT_NO, PATIENT_DETAILS.PAT_ID,
PATIENT_DETAILS.PAT_NAME, PATIENT_DETAILS.PAT_ADDRESS,
PATIENT_DETAILS.PAT_CITY, PATIENT_DETAILS.PAT_COUNTRY,
PATIENT_DETAILS.PAT_GENDER, PATIENT_DETAILS.PAT_DoB, PATIENT_DETAILS.PAT_ZIP,
PATIENT_DETAILS.PAT_PHNUM
FROM PATIENT_DETAILS
WHERE ((([PATIENT_DETAILS].[E_ID])=(SELECT [ePATIENT].[E_ID] FROM [ePATIENT]
WHERE [ePATIENT].[E_CHRONIC_DISEASES]=[Forms]![Search]![cmbdisease])));
i want only the listed columns after the first select statement from my
patient_details table,
but it must only show the fields where the E_ID column in my patients
details table is the same as the E_ID column from my ePATIENT table
where ePatient.E_CHRONIC_DISEASES is equal to the value passed from the
combobox called "cmbdisease" from the form called "Search"
when i run the query i am using a button to load it from my search form, so
the combobox is selected and the search form is present once i click the
button to load the query.
what happens is it returns all the columns i requested from the table i
requested but with no values.
I checked by removing the 2nd select statement and replacing it with an E_ID
number which does exhist, and this works it return the right field values
associated with the number
but with the select statement i returns all columns with no values.
so to narrow the search down theres obviously something wrong in the 2nd
select statement.
Please help, if possible