Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    361

    Unanswered: Link report to a macro

    I have a query that is too complex for a report, so I turned it into a make table query and then based the report on that table which works fine. I have that report tied to a switchboard. What when I press that button I have to answer the two message that come up when you run a make table query. Something like, tbl xyz will be deleted and you are about to paste x rows. Is there a way that I can default to yes for both of those so the user doesn't have to press yes both times? Thanks!

  2. #2
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    use the sendkeys command in your macro

  3. #3
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    Make the first line of the macro a SetWarnings and set for No and the macro will run straight through.

    Mike

  4. #4
    Join Date
    Mar 2004
    Posts
    361
    Sweet. Thanks!

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by Mike375
    Make the first line of the macro a SetWarnings and set for No and the macro will run straight through.

    Mike
    BE SURE TO REMEMBER THIS!!!!! When you use the SetWarnings for macros, BE sure once you set them to FALSE, right after it runs your command to set it back to SetWarnings = TRUE

    That setting can Cancel out ALL of your Access warning messages. If you created a NewTable from that query, what you should have done in effect was to create yet another query from that and then in your code behind the CommandButton that runs it use this instead:

    CurrentDB.Execute "yourQueryNameHere"

    That handles avoiding the Warning messages as well as keeps you from someday setting your warnings to OFF and forgetting to set them back ON again. Just a tip from what I learned in the past. Also, it's best to run Reports and Forms based on Queries. Yes, you can use Tables, but the more precise way is to use a Query. Also, one other note....try getting rid of your Macros and get used to VBA. It's much more flexible that Macros and when you Export forms and reports, you don't have to remember to find all of the associated macros that go with them. Code created in Form and Report Modules stay with them. How I learned to create VBA was to use the feature in Access to ConvertMacrosToCode. From that point I learned and lately don't have any more databases with Macros in them. And believe me, I am not a programmer, but hey, I'm learning. Just trying to be of help. Have a nice one.

    Bud
    Last edited by Bud; 05-15-04 at 07:50.

  6. #6
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    Bus,

    I am using Access 95 and SetWwarnings at No only applies to the particular macro.

    I just tried running a Macro which runs a Delete query followed by an Append query and with SetWarnings at No and then ran another macro that also runs a couple of queries and I had removed the SetWarnings line and it brought up the warnings. I also tried running an append query from the data base window after running the macro with SetWarnings at No and the warnings came up.

    In Access 95 SetWarnings defaults to No

    Mike

Posting Permissions

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