i have a form that filters results based on an entry in an unbound text box, i then have a button that creates a report from those filtered results, using this code - Private Sub Command8_Click()
-
If Me.Filter = "" Then
-
MsgBox "Apply a filter to the form first."
-
Else
-
DoCmd.OpenReport "Id", acViewPreview, , Me.Filter
-
End If
is there a way to put a heading on the report by entering it into an unbound text box in the form. so if im making an attendance report, i would like to enter 'attendance' in an unbound text box after i do my filter and then create my report and 'attendance' would be on the top of the report... thanks!
7 1451
For this I use a "Header/Footer" table with the name of the report as (part of) the key.
Thus each report can have a different header/footer and by storing it the user can always see the last entered value. (easy when multiple reports with same header should be produced.)
Idea ?
Nic;o)
Add a label to your report in the report Header section, and name it lbl_ReportTitle. Format it as you would like to see the report title, and make sure its wide enough to contain what people might write as a report title. If your report header section is not visible, you can add it by clicking on the detail section, and then selecting Report Header/Footer.
Now add the following code to the Reports open event - Private Sub Report_Open(Cancel as Integer)
-
me.lbl_ReportTitle=OpenArgs & ""
-
End Sub
The "" after the OpenArgs assures that if OpenArgs is null the code wont fail.
Add a textbox to your form, name it tb_ReportTitle.
Modify the code line of the command button to: - DoCmd.OpenReport "Id", acViewPreview, , Me.Filter ,, Me.tb_ReportTitle & ""
Another way of doing it without the textbox is to use a inputbox: - Dim strOpenArgs As String
-
strOpenArgs=InputBox("Name Report:","Report Title","Report Title")
-
DoCmd.OpenReport "Id", acViewPreview, , Me.Filter ,, strOpenArgs
Hope it helps.
i actually came up with this earlier... - Me.rpttxt = Forms!FormName!FormField
it works well... any thoughts id be glad to hear... thanks for your answers though!
I prefer not to refer to forms as a change of the form name or starting a report from a different form will cause "trouble".
The mentioned "OpenArgs" is preferable for "ad-hoc" passing of data and can be used "universally" as the table solution is "heavier" and would offer the user the advantage to have his(her) own text for a header or footer per report, thus saving you the trouble to add default texts like copyright, address info, etc..
Nic;o)
when i try it the way suggested, i get an error. "you cannot assign a value to this object" with the following highlighted
me.lbl_ReportTitle=OpenArgs & ""
My bad. Labels have a Caption not a value, so you need to include the .Caption to assign to labels. - Private Sub Report_Open(Cancel as Integer)
-
me.lbl_ReportTitle.Caption=OpenArgs & ""
-
End Sub
yep there it goes... awesome! thanks for your help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Stephan |
last post by:
Hi,
I'm using Visual Studio 2003 (C#) with the integrated
Crystal Report software and have the following question:
How can I assign a value (string) to an unbound (string)
field in Crystal...
|
by: Danny J. Lesandrini |
last post by:
First, this is _not_ a question about how to get Crystal Reports to run
on a client machine. I've got all the merge modules added to the project
and it's working fine. The question is about...
|
by: CSDunn |
last post by:
Hello,
I have a situation with MS Access 2000 in which I need to display report
data in spreadsheet orientation (much like a datasheet view for a form). If
you think of the report in terms of what...
|
by: Tom |
last post by:
This is related to an earlier post entitled "Text in Query/Numbers in
Report"
Brief recap - report has a query as a record source. The query shows
the correct data, the report translating the...
|
by: Danny J. Lesandrini |
last post by:
Didn't get any takers on this post this morning at dotnet.General, so I'm
reposting here.
First, this is _not_ a question about how to get Crystal Reports to run
on a client machine. I've got...
|
by: Kaur |
last post by:
Hi,
I am trying to create a crosstab type of report without using crosstab
query. The report captures several survey questions and for each survey
questions there are multiple choices that...
|
by: Stinky Pete |
last post by:
Evening,
I have a form that uses 5 pages (it's an electronic copy of the paper
version) we are going to use for manufacturing non conformances and
product deviations. In case your wondering,...
|
by: itmags |
last post by:
I need to create a couple of reports, invoices, credit reports, etc...
My question is: How/what is the best way to go about this using
VB2005 / SQL Server 2000
Crystal Reports? MS Reporting?...
|
by: lorirobn |
last post by:
Hi,
I have a report displaying items that are missing from a room. I
created 2 queries, the first getting the items IN the room, and the
second being an "unmatched" query that references the...
|
by: JessicaZ |
last post by:
Hi everyone! I'm new here and have a question regarding Leban's report to pdf tool. I am working on a database where we are using this code to send a report out to pdf(duh) BUT what I need to do is...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |