+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 23
  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    177

    Access / Automatically generate a report from a form?

    Is there anyway to automatically generate a report from a form? I'm trying to customize an app so whenever you enter a new record into a form, you can click on a button to save the new form and automatically generate a new report based on the info from the recently created form. I already have the layout of the form saved as a template, and I have all the current forms linked to the current reports. I don't, have a table created, is that what I'm missing?

  2. #2
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    If I understand what you're doing, it seems like what you would want is one form and one report. When you enter data into the form, you would have a button open the report and filter the data to display only the record you just entered.

    Am I close?

  3. #3
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551

    Re: Access / Automatically generate a report from a form?

    Originally posted by Turnip12
    I don't, have a table created, is that what I'm missing?
    I must have missed that part the first time I read this. You would need a table to do what I was talking about. The form would be linked to the table. When you enter the information into the form, it's stored in the table. The button would open the report (also linked to the table) and display the information from the form.

  4. #4
    Member
    Join Date
    Nov 2001
    Posts
    177
    Thanks for the replies, yes that's what I'm trying to do. So in order to do so, just create a table with the fields I want on the report/form and then link the the forms and reports to the table? For the button do I need to use VB to generate the reports, or is there an option somewhere. I stumbled across the autoreport option, but I'm new to Access and I wasn't sure if that's what I'm looking for.

  5. #5
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    Once the table is there and the report is created, you should be able to use the wizard when you create the button. It should pull up a dialog box like the one attached (I'm using Access 2000). You'll then choose the report you want to display. The wizard will create the VBA code that will display the report. You'll probably have to tweak the report after that to get it to display only the record you want.

    That should be enough to get you started. If you need more help, post back again. Good luck!
    Attached Thumbnails Attached Thumbnails Access / Automatically generate a report from a form?-access-button-wizard.gif  

  6. #6
    Member
    Join Date
    Nov 2001
    Posts
    177
    Thanks for your help before, I'm hoping you'll stumble on this again (or anyone else who might be able to help for that matter) When creating the table for the forms and reports to link to, do I need to create a field for ever field on the report, or just for the text boxes? There are several text boxes on the form that I'll need to set up so the values can be changed monthly, but all of the rest; labels, logos, etc, will be constant.

  7. #7
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    It sounds like you've figured it out. You only need to create fields in the table for the ones that will change. The rest will just be labels or pictures stored on the report.

  8. #8
    Ultimate Member ironforge's Avatar
    Join Date
    Oct 2001
    Posts
    1,118
    Is there a way to make a report that draws off multiple tables?

  9. #9
    addicted DVNT1's Avatar
    Join Date
    Oct 2001
    Location
    Ohio
    Posts
    6,103
    Originally posted by ironforge
    Is there a way to make a report that draws off multiple tables?
    yes, one way is to link the report to a query. Then inside the query add tables or other queries as needed

  10. #10
    Not Really a Member
    Join Date
    Oct 2001
    Posts
    27,899
    yeah you'll need to JOIN the tables though or it'll get pretty messy.
    Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.

  11. #11
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    LOL, without the join, it will show a record for all possible combinations of data in both tables.

  12. #12
    Member
    Join Date
    Nov 2001
    Posts
    177
    I have another question, if you Access/VB gurus don't mind. I have my table completed, along with my forms, everything seems to synch up correctly so now I'm dipping into code. If I'm creating code for buttons, or functions specific to a form, then I just create the button and then view code on that form, but if I'm creating global variables, etc, where do I write this code? Do I need to create a module under the database?

  13. #13
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    You can do it in a module, then call the function from the button's code. If I remember correctly, you need to make sure your function starts with "Sub" and not "Private Sub."

  14. #14
    Member
    Join Date
    Nov 2001
    Posts
    177
    Thanks for your help again Howste. Another question; (and the way I'm going I'll probably be posting more) I'm trying to set the visible properties of certain text and labels to false, if it doesn't contain anything. Wouldn't it be as simple as:
    If TxtFirst.Text = "" Then
    TxtFirst.Text.Visible = False
    Else
    TxtFirst.Text.Visible = True
    End If
    ? I tried it both under the module for the database, and for the seperate forms but no luck. I'm not getting any errors, but the fields remain visible unless I actually change the properties beforehand.

  15. #15
    Thaumaturge Member howste's Avatar
    Join Date
    Oct 2001
    Location
    West Haven, Utah
    Posts
    35,551
    You're talking about something I've never tried before. Are you doing this in a form, or is it a report? Either way, I don't know if you can change the text properties record-by-record like that. I think the display will be the same for the entire report/form. If I get a few minutes, I can maybe play with it and see if I can get it to work though...

  16. #16
    Member
    Join Date
    Nov 2001
    Posts
    177
    I'm trying to do it in a form, but those fields are in the table, along with one other form. I've been poking around the net and I've seen some articles about hiding fields in the query. That would probably have the same effect right? If I link the fields in the forms to the query, and then have an expression in the query that actually hid the fields?

  17. #17
    Member
    Join Date
    Sep 2002
    Posts
    364
    What event procedure did you put the hide textboxes in? You need to put it in something that will get called when it needs to, like when you navigate records or something like that.

  18. #18
    Member
    Join Date
    Nov 2001
    Posts
    177
    I have an update button, which performs some calculations, and updates certain fields with current values. I just put it in with that button. Ideally I'd like it to happen when the form loads, but I'm just trying to get it to work right now. If I can get it to happen I'll probably stick it in on the start up form under a button that loads this form.
    Last edited by Turnip12; November 3rd, 2002 at 01:38 AM.

  19. #19
    Member
    Join Date
    Sep 2002
    Posts
    364
    Seems like its not recognizing an empty string. You can try

    if len(text1.text) =0 then
    ...........

  20. #20
    Member
    Join Date
    Nov 2001
    Posts
    177
    Ok, I just gave up on the VBA, and just went straight VB, so now I have another question. When entering or changing information in a form that's linked to a table, it works the same as a table right? After entering or changing information in a field, when you switch to another field or record the information is automatically saved?

Quick Reply Quick Reply

If you are already a member, please login above.

What is 10 and 5 added together?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright 2014 All Enthusiast, Inc