If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Access Reports
Have a small employee database. Want to print ID cards for new hires.
report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg |
#2
|
|||
|
|||
Access Reports
"gg" wrote in message
t... Have a small employee database. Want to print ID cards for new hires. report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg What mechanism are you using to print your report? Carl Rapson |
#3
|
|||
|
|||
Access Reports
On Wed, 20 Jun 2007 13:51:33 -0700, gg wrote:
Have a small employee database. Want to print ID cards for new hires. report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg Your table should have a unique prime key field. In my example it is named [RecordID]. Display your employee records on a form. Add a command button. On the command button's property sheet write [Event Procedure] on the Click event line. Then click on the little button with 3 dots that will appear on that line. When the code window opens, the cursor will be flashing between 2 already existing lines of code. Between those 2 lines write: DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " & [RecordID] The above assumes a [RecordID] field that is a Number Datatype. If, however, [RecordID] is Text Datatype, then use: DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" & [RecordID] & "'" as the Where clause. For clarity, the single and double quotes are.. "[RecordID] = ' " & [RecordID] & " ' " Change [RecordID] to whatever the actual field name is that you are using. See VBA Help files for: Where Clause + Restrict data to a subset of records' -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#4
|
|||
|
|||
Access Reports
On Jun 20, 6:51 pm, fredg wrote:
On Wed, 20 Jun 2007 13:51:33 -0700, gg wrote: Have a small employee database. Want to print ID cards for new hires. report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg Your table should have a unique prime key field. In my example it is named [RecordID]. Display your employee records on a form. Add a command button. On the command button's property sheet write [Event Procedure] on the Click event line. Then click on the little button with 3 dots that will appear on that line. When the code window opens, the cursor will be flashing between 2 already existing lines of code. Between those 2 lines write: DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " & [RecordID] The above assumes a [RecordID] field that is a Number Datatype. If, however, [RecordID] is Text Datatype, then use: DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" & [RecordID] & "'" as the Where clause. For clarity, the single and double quotes are.. "[RecordID] = ' " & [RecordID] & " ' " Change [RecordID] to whatever the actual field name is that you are using. See VBA Help files for: Where Clause + Restrict data to a subset of records' -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail I had a similiar issue with employee applications. Instead of all the complex programming, I just duplicated the report and the query it was based on. Then I redefined my report (RPT#2 for reference) to be based on the QRY#2. Then in QRY#2, for my field EmpID I put in the following in the criteria box ( =[] ). No parentheses. Then when I am ready to generate one application instead of ALL, I click the RPT#2 which then asks for the parameter value (in this case the EmpID number (e.g. 225). This way we only get the report/application or in your case ID Card that you want for a specific employee. Kindest Regards, rod_skeeter |
#5
|
|||
|
|||
Access Reports
Thanks, Fred - Works great.
"fredg" wrote in message . .. On Wed, 20 Jun 2007 13:51:33 -0700, gg wrote: Have a small employee database. Want to print ID cards for new hires. report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg Your table should have a unique prime key field. In my example it is named [RecordID]. Display your employee records on a form. Add a command button. On the command button's property sheet write [Event Procedure] on the Click event line. Then click on the little button with 3 dots that will appear on that line. When the code window opens, the cursor will be flashing between 2 already existing lines of code. Between those 2 lines write: DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " & [RecordID] The above assumes a [RecordID] field that is a Number Datatype. If, however, [RecordID] is Text Datatype, then use: DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" & [RecordID] & "'" as the Where clause. For clarity, the single and double quotes are.. "[RecordID] = ' " & [RecordID] & " ' " Change [RecordID] to whatever the actual field name is that you are using. See VBA Help files for: Where Clause + Restrict data to a subset of records' -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
#6
|
|||
|
|||
Access Reports
Hi Fred,
I found this useful piece of information which is relevant to what i want to do as well. I've tried the code but with mine, it just opens the report as usual - i was expecting some kind of dialogue box to ask you what [RecordID] (or [StudyNumber], in my case) you want to filter by. it may be the design of my report - it's all very complex by basically there's a report with a number of subreports attached to queries. each of these subreports returns the data for all the study numbers but i wanted a filter as you open the report which means all the subreports (queries) filter by the given study number and just show results for one person. is this possible? thanks in advance for any help, Emma "fredg" wrote: On Wed, 20 Jun 2007 13:51:33 -0700, gg wrote: Have a small employee database. Want to print ID cards for new hires. report works fine for the whole file, but for one-at-a-time, it seems that the report doesn't respect to filter - It wants to print all records instead of the filtered table. Appreciate any help. gg Your table should have a unique prime key field. In my example it is named [RecordID]. Display your employee records on a form. Add a command button. On the command button's property sheet write [Event Procedure] on the Click event line. Then click on the little button with 3 dots that will appear on that line. When the code window opens, the cursor will be flashing between 2 already existing lines of code. Between those 2 lines write: DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " & [RecordID] The above assumes a [RecordID] field that is a Number Datatype. If, however, [RecordID] is Text Datatype, then use: DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" & [RecordID] & "'" as the Where clause. For clarity, the single and double quotes are.. "[RecordID] = ' " & [RecordID] & " ' " Change [RecordID] to whatever the actual field name is that you are using. See VBA Help files for: Where Clause + Restrict data to a subset of records' -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
Thread Tools | |
Display Modes | |
|
|