Results 1 to 6 of 6

Thread: [RESOLVED] Prompt everytime a INSERT SQL execution

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    27

    Resolved [RESOLVED] Prompt everytime a INSERT SQL execution

    I wrote a module to import data to Access from Excel using:

    DoCmd.RunSQL (query)

    The query contains a INSERT INTO... type SQL statement. Everytime Access runs this line it prompts me if it is ok to add a record to the database. Is there a way to remove this prompt?
    Last edited by Hack; Mar 31st, 2006 at 07:28 AM.

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Prompt everytime a INSERT SQL execution

    Turn warning off before you run the query, then turn them back on.
    VB Code:
    1. DoCmd.SetWarnings False
    2. DoCmd.RunSQL (Query)
    3. DoCmd.SetWarnings True
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    27

    Re: Prompt everytime a INSERT SQL execution

    Thanks DKenny!

    I will give that a shot.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    27

    Re: Prompt everytime a INSERT SQL execution

    By any chance, do you know how to swap the labeling of rows and colums in Excel?

    This means that If I want to access A3, I would type in 1C instead or if I wanted B4, I would type in 2D?

  5. #5
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Prompt everytime a INSERT SQL execution

    First off, why would you want to do this?

    Next, when you say "type in 1C" do you mean into a formula in an excel cell or a range reference in VBA?

    Also, how do you plan on dealing with the fact that there are more rows than columns in a worksheet.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    27

    Re: Prompt everytime a INSERT SQL execution

    It is out of "kind a" curiousity. The reason is in VBA you seem to have to access a cell by numbers i.e. (2,3) => B3. In my case I know exactly how many I need in the vertical direction, but have to access specific columns. Thus seeing AM and converting to a number is a pain.

    A somewhat cludgy solution to this is to insert a row and put in 1 and 2 for the two first horizontal cell and drag it out...

    But it would be neat to be able to swap them sometimes. Sometimes you might have a lot more columns than rows and typing in a formula as "1C" would be convenient...

Posting Permissions

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



Click Here to Expand Forum to Full Width