Make a Report Preview with New Records???????

G

guitarfunk24

I don't even know if this is possible but ok here it goes I am making
a database and I would like to make a report that shows the data I
have on a form for new records that i would type in but NOT save the
records into my table so I can print the data out if need be but maybe
I would like to change it before i finalize it. I have a Report
button code to open a report as shown:
Private Sub Add_Component_Click()
On Error GoTo Err_Add_Component_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Add Components List Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Add_Component_Click:
Exit Sub

Err_Add_Component_Click:
MsgBox Err.Description
Resume Exit_Add_Component_Click

End Sub
But here is the other thing because I don't want data saved all the
time i have a code in before update on the form that asks me if i want
the data I typed saved or not. which goes like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = MsgBox("Do you want to save changes to this record?" _
, vbQuestion + vbYesNo + vbDefaultButton2, "Save Record") =
vbNo
If Cancel Then
Me.Undo
End If
End Sub
Now here is the problem when I try and click the button to open the
report it asks me if i want the data saved but i don't and if I dont
my report will not show up. But if i do it will save it then show the
data but ruining my table. So is it possible to show this data on a
report without saving it.
 
J

John W. Vinson

Now here is the problem when I try and click the button to open the
report it asks me if i want the data saved but i don't and if I dont
my report will not show up. But if i do it will save it then show the
data but ruining my table. So is it possible to show this data on a
report without saving it.

It's possible, but not easy. Typically a Report is based on a query displaying
data in a Table (put there via a Form, usually). A Form isn't really a very
good data repository - I'm not sure that printing out the contents of an
unsaved form record will get you all that much ! You'll need to leave the Form
open to the record; you can look at the data on the form just as easily as on
a sheet of paper.

But... if you really want to waste paper... you can create an unbound Report
(don't base it on ANY table), and put controls on it with control sources

=Forms!YourFormName!Controlname

to display the contents of the currently-open record on the form. Do this for
all the controls that you want to see. Print the report from a command button
on the form (the command button wizard will do this for you).

John W. Vinson [MVP]
 
G

guitarfunk24

It's possible, butnoteasy. Typically aReportis based on a query displaying
data in a Table (put there via a Form, usually). A Form isn't really a very
good data repository - I'mnotsure that printing out the contents of an
unsaved form record will get you all that much ! You'll need to leave the Form
open to the record; you can look at the data on the form just as easily as on
a sheet of paper.

But... if you really want to waste paper... you can create an unboundReport
(don't base it on ANY table), and put controls on it with control sources

=Forms!YourFormName!Controlname

to display the contents of the currently-open record on the form. Do this for
all the controls that you want to see. Print thereportfrom a command button
on the form (the command button wizard will do this for you).

John W. Vinson [MVP]

Well thank you for the help on the report problem I am still working
on it but just so you know it is for a cost analysis for a company so
we can sell ideas and how much they cost and make a neat sheet so you
can report you information. If we where to save it because we did
want that idea then we could save it. But I don't want to save
something we may never use. If you have anymore help on it it would
be most helpful because I did replace my report with the formula above
but the form still asks me if I want it saved and if I click no it
deletes what I typed.
 

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