Pass Unbound and Query Data to a Report.

K

Kirk

I have a form that has unbound data that is used with query data for
calculations. I do not want the unbound data saved. How can I pass unbound
parameters as well as the query to the report. I don't want my users to have
to rekey the unbound data in an unbound parameter form. The record source for
the form contains two fields as a key, I want to collect two additional
pieces of data and pass all four fields to my report. I would certainly
appreciate any comment.
 
T

Tom van Stiphout

On Wed, 9 Jan 2008 10:16:00 -0800, Kirk

In recent versions of Access you can use the OpenArgs argument of
DoCmd.OpenReport. In older ones, your Report_Open event procedure will
have to "look back" to the form and pick up the values.

-Tom.
 
K

Kirk

Thanks Tom, I tried that but I am syntax challenged often. I use Access
2003, but the database may be in the 2000 version. Regardless, I'm glad I
was going down the right path and not completely missing out on something.
I'll keep working on the syntax.

Do you think I need to move the database to a 2003 version?
 
K

Kirk

Okay,
I was able to get the openargs to send the data to the report. I am now
getting the runtime errror 2448, you cannot assign a value to this object.

Here is my code for one of the controls regarding adding the value from
OpenArg to the control on the report:

stProposedSalePrice = Mid(stOpenArgs, (var1CommaLocation + 1), _
varLenProposedSaleOffer)
Reports!TestReport!ProposedSalePrice = CStr(stProposedSalePrice)

(I concatenate multiple values in a string for the OpenArg).

If anyone can help it would be great!
-Kirk.
 
K

Kirk

Okay, I don't know if this is the most efficient solution, but it works, it
certainly is not elegant:
1) Instead of assigning the OpenArgs value(s) to a new text box on the
report, I assigned the OpenArgs values to the the the caption value of a
label.
2) I then created a text box that used the caption of the label as its
value.
3) Then I hid the label.

I guess I could have just used some conversion steps in the calculations of
other controls using the label caption, or maybe some VB code behind the
report. But this works for me.

I don't know why you can't assign a value to an unbound text box on a report
from the OpenArgs property of the report, but I'm guessing that is what that
runtime error is referrring to.

- Kirk.
 

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