Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2003
    Posts
    6

    Command button to create reports and export files

    I have a form with a textbox called txtZipCode, where the user will put in a zipcode. I then have a command button that they can click in order to view a report. I want the report that they will view to be based on a certain table and only include the zip code that the user typed in. I don't think that the command button wizard will do all this for me. I am thinking I might have to have two buttons. One to create the query and one to create the report?

    The second thing I want to do is to create a button that will export the report to a place that the user specifies into a format that he/she specifies, for example .csv.

    Are there ways to do things like these in Access?

    Gurka

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,739
    your report is based on a query.
    the query includes the zipcode field

    open the query design grid; click once in the criteria box in the zipcode column; click the "magic-wand" builder in the main menu bar: in the left pane navigate: forms¦all forms¦your form; and then double-click the txtZipCode field in the right pane.

    your query now uses the zipcode on your form to provide criteria.

    izy

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,739
    the second thing: yes!

    use .SNP if you want to preserve formatting. an example:

    DoCmd.OutputTo acOutputReport, "reportName", "Snapshot Format", "drive:/path/path/filename.SNP"

    you'll find lots of options in .OutputTo


    izy

  4. #4
    Join Date
    Jul 2003
    Posts
    6
    Thanks, I got it to work. Now I need to get more than one zip code in the textbox and for it to show up in the report. I thought it would work since I can put in the criteia field something like: "75000" or "75001" or "75002" and it will work, but that didn't work in the textfield.
    Can you help me?

    Gurka

  5. #5
    Join Date
    Jul 2003
    Posts
    25

    Wink

    Try *77200* in your text box and then it should work.

    If you do not want to type * all the time, then create another text box that = *your original text box* and run the query off the new text box you have created. Make sure you hide the text box in functionality use, cheers.


    Then one you user enters 784940 the new text box will be *784940* and so it will work.

    (make sure in your criteria box in the query that you put Like(your text box) etc)




    Phil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •