insert text to report on the fly

G

Guest

Hey all
I work in a media library, which collects and holds onto software packages.
These are identified by a serial number in our database (i'll call it D4).
I have a report, based on a query, which details the information on these
media.
When you run the report, it is setup to prompt for up to 5 different
criteria (the D4 number) which appear on the report. The report is grouped
by D4 number. The layout/sections in design mode goes (top to bottom): Page
header; D4 Header; Detail; Page Footer
Here's my issue:
Normally we run the report, then export it as RTF to be able to insert
additonal formatting/notes. In the D4 Header section, there is a label
called Notes, where when we export it, we fill in the info in Word. What i
want is to be able to put in a unbound text box beside it and be prompted for
the notes for each D4 number, so they appear in the report automatically.
These notes are only used by another department in creating a letter, so we
don't want to create another table to save them in. I just want to be able
to inject them into the report on-the-fly, so I don't have to then mess
around with editing it in word. I hope this makes sense and thanks in
advance to anynoe who can help. I'm using Access 2000 (i know, i know, it's
ancient, but i'm stuck with it here :(
 
A

Arvin Meyer [MVP]

I'd put the unbound textbox on the form with the button that opens the
report. That way you can always be sure it's there and you won't get an
error. In the report, add an unbound text box as well with the CanShrink and
CanGrow properties turned on. The unbound textbox on the report to:

=Forms!YourFormName!TheTextboxName

That should do it!
 
G

Guest

thanks for the tip; however, i should have mentioed the report is not opened
off a form, it's just opened from the database window, and then starts
prompting for the D4 number.
 
G

Guest

thanks for the tip!! however, I should have mentioned that the report is not
run off a form, simply opened from the database window. is it opssible to
use code, maybe an onLoad event, that could use say InputBox to grab a note
for each D4 then insert it for each number?
 
A

Arvin Meyer [MVP]

You cannot add data to a report at runtime, unless you do it in code, but I
can think of a sneaky workaround that will only work in an Access query.

Add a column to your query, call it RptNote so it looks like this:

RptNote: [Enter the D4 Note]

It is important that it looks exactly like the above, but the words within
the square brackets can be any prompt you want.

Now when the query opens, you'll get an input prompt that says Enter the D4
Note

If you don't enter anything, there will be no note, otherwise, the text up
to 1024 characters (I'm not sure of that number) will appear in that column.
Now add a textbox to your report and bind it to the alias field RptNote.

That's it, Access: 1 Oracle Designer: 0
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
B

billybanter67

You cannot add data to areportat runtime, unless you do it in code, but I
can think of a sneaky workaround that will only work in an Access query.

Add a column to your query, call it RptNote so it looks like this:

RptNote: [Enter the D4 Note]

It is important that it looks exactly like the above, but the words within
the square brackets can be any prompt you want.

Now when the query opens, you'll get an input prompt that says Enter the D4
Note

If you don't enter anything, there will be no note, otherwise, thetextup
to 1024 characters (I'm not sure of that number) will appear in that column.
Now add a textbox to yourreportand bind it to the alias field RptNote.

That's it, Access: 1 Oracle Designer: 0
--
Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmvp.com


thanks for the tip; however, i should have mentioed thereportis not
opened
off aform, it's just opened from the database window, and then starts
prompting for the D4 number.

Is it possible to open a report with a command button and have a text
box in the report get information with out have the report text box
having any code?

This is what I have so far but it won't display anything in the report
on print preview, it only shows up if you open the report in edit mode
then preview.

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim stDocName As String

stDocName = "dateatest"
DoCmd.OpenReport stDocName, acViewPreview, , "Estimator= forms!
DataDrill!Estimator"
Reports!dateatest.datalist.Value = Forms!DataDrill.Estimator.Value

Exit_Command8_Click:
Exit Sub

Err_Command8_Click:
MsgBox Err.Description
Resume Exit_Command8_Click

End Sub
 
A

Arvin Meyer [MVP]

That will not work. Once the report is open you can't change any part of it.
There are only 3 ways to get something to print on a report.

1. Run code in the Format event, which occurs before the report is viewable.

2. Change the data in the recordsource (the method I showed you)

3. Read the data in a controlsource from an Open form,
 

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