Liniking a forms current contents to a report

G

Guest

Currently on the database that I'm working on, the user pulls up a daily log
form, inputs data into the form, presses next record button, which moves to
another blank record and saves the data on the previous record, and then the
user starts to input data again.

Now, when the user finishes inputting data, he needs to be able to print the
data on the form before moving to the next record. What I'm doing is creating
a button which saves the current record, then opens a report which calls to
the table to get the previous saved record. What I don't know is the code for
that. I've created the report, and I know to grab the uniaue key data on the
form to search the table with, but how do you tell the report just to show
that 1 record? Currently the report is showing all the records in the table.
Any and all help for the acess newbie is appreciated.
 
D

David Lloyd

Matt:

In the query behind the report you can set a WHERE condition like:

WHERE KeyID = Forms!MyInputForm!txtKeyID

where txtKeyID is the name of the textbox holding the key data. The form
will need to be open at this point, of course to read the value.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Currently on the database that I'm working on, the user pulls up a daily log
form, inputs data into the form, presses next record button, which moves to
another blank record and saves the data on the previous record, and then the
user starts to input data again.

Now, when the user finishes inputting data, he needs to be able to print the
data on the form before moving to the next record. What I'm doing is
creating
a button which saves the current record, then opens a report which calls to
the table to get the previous saved record. What I don't know is the code
for
that. I've created the report, and I know to grab the uniaue key data on the
form to search the table with, but how do you tell the report just to show
that 1 record? Currently the report is showing all the records in the table.
Any and all help for the acess newbie is appreciated.
 
G

Guest

Thank you David and Allene. The tips worked great, and now I have it working
corretly
 
G

Guest

Hi Allene

I have tried your suggestion.....My unique field to identify the Record is
"ECMA". When I click the button to run the report it pops up with a msg box
with "ECMA" and a txt box underneath. If I enter the ECMA in the text box the
Report opens but still shows all the Records. Please help..i'm still a novice
in Access.

Thank you for your help
 
R

Rick Brandt

Kirt84 said:
Hi Allene

I have tried your suggestion.....My unique field to identify the
Record is "ECMA". When I click the button to run the report it pops
up with a msg box with "ECMA" and a txt box underneath. If I enter
the ECMA in the text box the Report opens but still shows all the
Records. Please help..i'm still a novice in Access.

That suggests that your report's RecordSource has no field named "ECMA". If you
open the report in design view and display the field list is ECMA in the list.
If not, you need to modify the query used so that it is.
 
G

Guest

Thank you so much this works!! One more question - on the form I have a label
that is Visible/Invisible depending on the type of product it is (in my case
its a Fridge line or not a Fridge line). At the moment for all products the
warning "This is a fridge line product", appears on the report. I want the
label not to appear when the user is not dealing with a Fridge line product.
 
R

Rick Brandt

Kirt84 said:
Thank you so much this works!! One more question - on the form I have
a label that is Visible/Invisible depending on the type of product it
is (in my case its a Fridge line or not a Fridge line). At the moment
for all products the warning "This is a fridge line product", appears
on the report. I want the label not to appear when the user is not
dealing with a Fridge line product.

Replace the label with a TextBox. Us a ControlSource with the Immediate-If
function that displays yuour text when appropriate and displays ""
otherwise. You didn't give field names or values, but an example would look
like...

=IIf([ProductType] = "Fridge line", "This is a fridge line product", "")
 

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