PC Review


Reply
Thread Tools Rate Thread

Control Source for text box on report to display the field name

 
 
livin''''life
Guest
Posts: n/a
 
      9th Oct 2008
I have a database that tracks employees and the dates that they have
completed some training. Example:

SSN Last First MI Class1 Class2 Class3 Class 4 etc...

I have created a form that allows me to print a report of all employees that
have completed a class. Using a dropdown box it builds queries on the fly
and sends the info to a report.

What I would like to do is place a button on the form that will print all of
these reports. The direction that I am heading is that when the user clicks
the button the following happens:
1. Build a query for all who completed Class1 (always named qry_ClassComplete)
2. Sends it to a report (always named rpt_ClassComplete)
3. Report Prints
4. Deletes the query
5. Build a query for all who completed Class2
etc...

What I would like to do is add a text box to the report that displays the
name of the class at the top. Ex(List for Class: Class1) where the class1
changes on each report. Not sure if this is possible so any help is
appreciated.

Also, if you know a better way to do this I am open to that too. Thank you
all for the time you take to answer our questions.

 
Reply With Quote
 
 
 
 
livin''''life
Guest
Posts: n/a
 
      9th Oct 2008
Here is the code I am using to help in case I did not explain it as well as
it could have been done.

'Class1

dbs.QueryDefs.Delete ("qry_ClassComplete")
strSql = "SELECT [tbl_ClassDates].[Social_Security_Number],
[tbl_ClassDates].[Last_Name], [tbl_ClassDates].[First_Name],
[tbl_ClassDates].MI
FROM [tbl_ClassDates]
WHERE ((([tbl_ClassDates].Class1)
>=[Forms]![frm_PrintClassList]![txt_ClassDate1])) AND

((([tbl_ClassDates].[Class1])
<=[Forms]![frm_PrintClassList]![txt_ClassDate2]))
GROUP BY [tbl_ClassDates].[Social_Security_Number],
[tbl_ClassDates].[Last_Name], [tbl_ClassDates].[First_Name],
[tbl_ClassDates].MI
ORDER BY [Last_Name], [First_Name];"
Set qdf = dbs.CreateQueryDef("qry_ClassComplete", strSql)

Reports!rpt_ClassComplete!txt_ClassName = "Class1" (for some reason this is
not displaying the information)
DoCmd.OpenReport stDocName, acViewNormal
DoCmd.DeleteObject acQuery, "qry_ClassComplete"

'Class2

Same as above but for Class2



"livin''''life" wrote:

> I have a database that tracks employees and the dates that they have
> completed some training. Example:
>
> SSN Last First MI Class1 Class2 Class3 Class 4 etc...
>
> I have created a form that allows me to print a report of all employees that
> have completed a class. Using a dropdown box it builds queries on the fly
> and sends the info to a report.
>
> What I would like to do is place a button on the form that will print all of
> these reports. The direction that I am heading is that when the user clicks
> the button the following happens:
> 1. Build a query for all who completed Class1 (always named qry_ClassComplete)
> 2. Sends it to a report (always named rpt_ClassComplete)
> 3. Report Prints
> 4. Deletes the query
> 5. Build a query for all who completed Class2
> etc...
>
> What I would like to do is add a text box to the report that displays the
> name of the class at the top. Ex(List for Class: Class1) where the class1
> changes on each report. Not sure if this is possible so any help is
> appreciated.
>
> Also, if you know a better way to do this I am open to that too. Thank you
> all for the time you take to answer our questions.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set field data as control source of another field in a report Hisham Al Masri Microsoft Access Reports 2 22nd Mar 2008 09:00 AM
Use a field from another report as the control source in a 2nd rep =?Utf-8?B?S2FybA==?= Microsoft Access Reports 0 1st Aug 2007 06:56 PM
Control Source for text box on a report CEV Microsoft Access Reports 4 14th May 2007 10:08 AM
Syntax to change Control Source for a Report Field Kahuna Microsoft Access Reports 1 29th Jan 2007 04:04 PM
print a form field's control source on a report =?Utf-8?B?Z2VlYmVl?= Microsoft Access Reports 1 8th Nov 2004 05:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 AM.