Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on Converting A Form to A Report 1

Status
Not open for further replies.

SwingXH

Technical User
Jun 15, 2004
97
US
I am a beginner on MS Access. I recently created a form for interative data input and I want to save the form as a report. My question is that when I save the form as report, only the default contents in the form was saved, the text or other information that I keyed in is not saved on the report. How to solve this problem? I want to save the whole information to a report.
Thanks a lot.

Another question:
Since for report, one can not interactively input data in the field, i was thinking of creating a command on a form using VBA to fill the data into the corresponding field on the report. For example, there is a textbox text1 on report1.
Can I write some simple code in Form1 like these:
report1.text1.text=1
It looked like did not work for me.
Anybody can help me?

Thanks a lot!
SwingXH
 
The purpose of a form, as you have indicated, is primarily for data input or editing. The primary purpose of a report is to show the data that you have entered into the form. The output to the report can look as you wish. To help simplify the sitation, create the report, by using the wizard, of the table/query that you used to create the form. In the design view of the report, the properties of the report itself will indicate the table/query in the Record Source of the report.
I think that before you try to tackle the second part of your question, learn how to do the first part.

Hope this helps.

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
Autonumber Description - FAQ702-5106
 
First of all, thanks for your reply.
Using wizard won't help me. The format of the report that I want is just look like regular report, including many information, not only tables but also other text, lables, etc.

If I can get the solution for the second part of my question, that will help a lot.

Thanks.
 
SwingXH
I have been hunting for an article entitled "Saving a Form as a Report, and Why You Shouldn't" but can't find it.

It is true that Access can save a form as a report, but its value is very limited. mph1 is right in suggesting that you are mixing up two different purposes.

You can design a report to do anything you wish, and make it look like anything you wish. The report should be based on either a query or a table, depending on what you need.

I am wondering if you have looked at the various reports in the Northwind sample database that ships with Access. Also, you can go to the Microsoft Knowledge Base and download a collection of sample forms, sample queries, and sample reports.

That might help you along the way to what you wish to accomplish.

Tom
 
SwingXH
The link to Microsoft Knowledge Base is
For sample reports, search for article # 231851

For sample forms, search for article # 233324

For sample queries, search for article # 207626

Tom
 
Thanks a lot Tom.
Another question, I created a report with data linked by a form input. For text fields in the report I could do it successfully, but how to link the picture in the report.
The idea is that in the form, user can specify the name of the figure, then I want the corresponding figure automatlly update in the report.
Thanks a lot!

SwingXH
 
SwingXH
If I understand you correctly, you want to select a particular record in the form, and have the report show that record, complete with picture etc.

Assuming also that your form and report are based on the table which includes everything, including the picture, here's what to do...

Put a command button on your form, to either preview or print a report. The command button would have code such as follows...
Code:
Private Sub YourCommandButton_Click()
On Error GoTo Err_YourCommandButton_Click

    Dim stDocName As String

    stDocName = "YourReportName"
    DoCmd.OpenReport stDocName, acPreview, "", "[RecordID]=[Forms]![YourFormName]![RecordID]"

Exit_YourCommandButton_Click:
    Exit Sub

Err_YourCommandButton_Click:
    MsgBox Err.Description
    Resume Exit_YourCommandButton_Click
    
End Sub

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top