Filter Report via Button

G

Guest

I have a query, qryTardyDaily, that filters to show all the students tardy =date().

There are 4 fields: period, grade, studentid, date.

I have a form where the principals update the consequences of the student' tardies. Once they are updated, the principals would like to be able to print just the records that are equal to their grade, ie 10, 11, or 12.

Is there a way to place a button on a form that would filter the results of tblTardyDaily and just print those records equal the grade selected?
 
K

Ken Snell

Wizard for buttons in form design will do this. Essentially you use the
OnClick event of the command button to open a report using the
DoCmd.OpenReport action. The fourth argument of that action can be a string
that specifies a WHERE criterion (without the WHERE) to filter the report's
recordset.


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
I have a query, qryTardyDaily, that filters to show all the students tardy =date().

There are 4 fields: period, grade, studentid, date.

I have a form where the principals update the consequences of the student'
tardies. Once they are updated, the principals would like to be able to
print just the records that are equal to their grade, ie 10, 11, or 12.
Is there a way to place a button on a form that would filter the results
of tblTardyDaily and just print those records equal the grade selected?
 
G

Guest

Ok Ken, The Command Button Wizard doesn't offer the ability to filter records. I tried this method, but the debugger keeps comming up.
docmd.openreport, acViewNormal,,[qryTardyDaily.grade]=10

I know the error is in the =10 part, but I don't have the control on a form, I just have a button. I appreciate the help.
--
Thanks As Always
Rip


Ken Snell said:
Wizard for buttons in form design will do this. Essentially you use the
OnClick event of the command button to open a report using the
DoCmd.OpenReport action. The fourth argument of that action can be a string
that specifies a WHERE criterion (without the WHERE) to filter the report's
recordset.


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
I have a query, qryTardyDaily, that filters to show all the students tardy =date().

There are 4 fields: period, grade, studentid, date.

I have a form where the principals update the consequences of the student'
tardies. Once they are updated, the principals would like to be able to
print just the records that are equal to their grade, ie 10, 11, or 12.
Is there a way to place a button on a form that would filter the results
of tblTardyDaily and just print those records equal the grade selected?
 
K

Ken Snell

Try this:

DoCmd.OpenReport acViewNormal, , , "[qryTardyDaily.grade]=10"


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
Ok Ken, The Command Button Wizard doesn't offer the ability to filter
records. I tried this method, but the debugger keeps comming up.
docmd.openreport, acViewNormal,,[qryTardyDaily.grade]=10

I know the error is in the =10 part, but I don't have the control on a
form, I just have a button. I appreciate the help.
--
Thanks As Always
Rip


Ken Snell said:
Wizard for buttons in form design will do this. Essentially you use the
OnClick event of the command button to open a report using the
DoCmd.OpenReport action. The fourth argument of that action can be a string
that specifies a WHERE criterion (without the WHERE) to filter the report's
recordset.


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
I have a query, qryTardyDaily, that filters to show all the students
tardy
=date().
There are 4 fields: period, grade, studentid, date.

I have a form where the principals update the consequences of the
student'
tardies. Once they are updated, the principals would like to be able to
print just the records that are equal to their grade, ie 10, 11, or 12.
Is there a way to place a button on a form that would filter the
results
of tblTardyDaily and just print those records equal the grade selected?
 
G

Guest

Worked like a champ Ken. Thank you. I always forget about our little " " friends.
--
Thanks As Always
Rip


Ken Snell said:
Try this:

DoCmd.OpenReport acViewNormal, , , "[qryTardyDaily.grade]=10"


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
Ok Ken, The Command Button Wizard doesn't offer the ability to filter
records. I tried this method, but the debugger keeps comming up.
docmd.openreport, acViewNormal,,[qryTardyDaily.grade]=10

I know the error is in the =10 part, but I don't have the control on a
form, I just have a button. I appreciate the help.
 
K

Ken Snell

You're welcome.

--

Ken Snell
<MS ACCESS MVP>

Ripper said:
Worked like a champ Ken. Thank you. I always forget about our little " " friends.
--
Thanks As Always
Rip


Ken Snell said:
Try this:

DoCmd.OpenReport acViewNormal, , , "[qryTardyDaily.grade]=10"


--

Ken Snell
<MS ACCESS MVP>

Ripper said:
Ok Ken, The Command Button Wizard doesn't offer the ability to filter
records. I tried this method, but the debugger keeps comming up.
docmd.openreport, acViewNormal,,[qryTardyDaily.grade]=10

I know the error is in the =10 part, but I don't have the control on a
form, I just have a button. I appreciate the help.
--
Thanks As Always
Rip


:

Wizard for buttons in form design will do this. Essentially you use the
OnClick event of the command button to open a report using the
DoCmd.OpenReport action. The fourth argument of that action can be a string
that specifies a WHERE criterion (without the WHERE) to filter the report's
recordset.


--

Ken Snell
<MS ACCESS MVP>

I have a query, qryTardyDaily, that filters to show all the
students
tardy
=date().

There are 4 fields: period, grade, studentid, date.

I have a form where the principals update the consequences of the student'
tardies. Once they are updated, the principals would like to be able to
print just the records that are equal to their grade, ie 10, 11, or 12.

Is there a way to place a button on a form that would filter the results
of tblTardyDaily and just print those records equal the grade selected?
 

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