[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?
Re: Prompt everytime a INSERT SQL execution
Turn warning off before you run the query, then turn them back on.
VB Code:
DoCmd.SetWarnings False
DoCmd.RunSQL (Query)
DoCmd.SetWarnings True
Re: Prompt everytime a INSERT SQL execution
Thanks DKenny!
I will give that a shot.
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?
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.
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...