P
pragv
Hi,
I have a report that gets the data from a query. The query uses an
inner join between two tables. The report works fine. The report
contains information about several people. I now want to filter the
data. I used a form with a combo box (based on a table). It contains a
list of people. When a selection is made in the combo box and a button
is clicked, I would like to show the information relevant to the
selected person.
I used the following code for the click button
DoCmd.OpenReport "rptAVSP", acViewPreview, , "Person_Name=" &
forms![frmperson]List
But that doesn't seem to work. So I also tried putting a WHERE
condition in the query (on which the fomr is based) like
SELECT tblhrs.Person_Name, tblhrs.acthrs, tblpct.pcthrs (and so on...)
FROM tblhrs INNER JOIN tblpct ON
(tblhrs.Person_Name=tblpct.Person_Name)
WHERE tblhrs.Person_Name=forms![frmperson]List
When I run the report from the form(frmperson), the report shows no
result at all!
This time, I used the following code as I already have the condition in
the query
DoCmd.OpenReport "rptAVSP", acViewPreview
I know I'm making a simple mistake somewhere but cant really figure
out.
Sometimes, in the first case, the entire query gets erased too...
Can anyone please help me here.
Thanks
Pragv
I have a report that gets the data from a query. The query uses an
inner join between two tables. The report works fine. The report
contains information about several people. I now want to filter the
data. I used a form with a combo box (based on a table). It contains a
list of people. When a selection is made in the combo box and a button
is clicked, I would like to show the information relevant to the
selected person.
I used the following code for the click button
DoCmd.OpenReport "rptAVSP", acViewPreview, , "Person_Name=" &
forms![frmperson]List
But that doesn't seem to work. So I also tried putting a WHERE
condition in the query (on which the fomr is based) like
SELECT tblhrs.Person_Name, tblhrs.acthrs, tblpct.pcthrs (and so on...)
FROM tblhrs INNER JOIN tblpct ON
(tblhrs.Person_Name=tblpct.Person_Name)
WHERE tblhrs.Person_Name=forms![frmperson]List
When I run the report from the form(frmperson), the report shows no
result at all!
This time, I used the following code as I already have the condition in
the query
DoCmd.OpenReport "rptAVSP", acViewPreview
I know I'm making a simple mistake somewhere but cant really figure
out.
Sometimes, in the first case, the entire query gets erased too...
Can anyone please help me here.
Thanks
Pragv