How to get *just* update query confirmation

G

Guest

Hi all,

When I run an update query Access warns me I'm about to run an update query
then stops again and tells me how rows are about to be updated. 2 warnings.

How do I get it to just give the one (sensible) warning?

Unticking the Edit/Find Confirm option removes the warning altogether. FFS.

Is that my only choice, 2 warnings or no warning?
 
A

Allen Browne

How are you running this query?

If you use the Execute method, you can:
a) avoid the unnecessary warning;
b) get any failure message;
c) get the number of records affected;
d) use a transaction and rollback if desired.

The disadvantages of the Execute method are:
a) You need to resolve any parameters before the execute.
b) There is more work in getting the transaction right.

Basic code to exeute Query1 and report the results:
With dbEngine(0)(0)
.Execute "Query1"
MsgBox .RecordAffected " record(s) inserted."
End With

The parameters issue applies only if your query contains something like:
[Enter a date]
or
[Forms].[Form1].[Text0]
My preference is to build the SQL string to concatenate these values in, and
execute the string rather than a saved query.

For an example of how to get the transaction right, see
Archive: Move records to another table
at:
http://allenbrowne.com/ser-37.html
The example shows how to execute 2 transactions and roll them both back, but
the process is the same for a single transaction.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
G

Guest

Allen Browne said:
How are you running this query?

Yes, I should have specified.

From the Queries listing.

My post was more about how poorly warning the user is handled by Access.
IIRR previous versions of Access handled this occurence with a single warning.

Basically all I want to know is how many records are updated with having to
go through a warning clicking 'frenzy'.

The first warning says 'to prevent this message from appearing...' when what
it should actually say is 'to prevent this message *and* the next message
from appearing...'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top