For the ControlSource properties of the controls on the report reference
those on the form, e.g.
=[Forms]![MyForm]![MyTextBox]
Each control on the form will need to have been updated, i.e. by pressing
Enter, Tab or moving off the control with the mouse, so the best way to
ensure this is to open the report from a button on the same form with, e.g.
DoCmd.OpenReport "MyReport", View:=acViewPreview
The form will need to remain open when the report is opened, so if you want
it to close automatically then include code in the report's Close event
procedure to close the form, e.g.
DoCmd.Close acForm, "MyForm"
Another way, which allows you to close the form before the report opens,
would be to pass the values from the form to the report as its OpenArgs
property. For this you'd need either to parse the OpenArgs property to
extract the individual values, or a better way is to pass named arguments
using the module which I've posted at:
http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=24091&webtag=ws-msdevapps
However you do it, one thing to watch out for is if you've used a combo box
on the form whose value is a hidden column, e.g. a combo box showing customer
names would usually have a numeric value of CustomerID in a hidden column.
In a case like this you could either use an identical combo box on the form,
which is inefficient, or include the customer name in a hidden text box on
the form with a ControlSource such as =[cboCustomer].[Column](1), which
references the second column of the combo box, the Column property being
zero-based. In the report you'd then reference the hidden text box rather
than the combo box.
Ken Sheridan
Stafford, England
Stockwell43 said:
Hello,
I have a question about moving data.
I have an Access Form that has Unbound fields. I have a Report in access
that has every field from the form. When I type in the fields on the form and
then open the report, the report is blank. I do not want to save the
information to table. So how would I get this to work so when the user inputs
data in the form, it will show on the report when they click the preview
button?
Please simplify answer as I have not done anything like this before.
Thanks!!