Suppressing query messages

G

Guest

Hi there,

I have 6 queries I need to run which will fill in null records in 6 fields.
I don't want my users to have to click "Yes" 6 times. How can I suppress the
"You are about to update xxx rows" messages. The following code and sql are
an example.

DoCmd.OpenQuery "qryUpdtGST0", acNormal, acEdit

SQL code from the query SQL View:

UPDATE tblFinalData SET tblFinalData.GSTRatio = 0
WHERE (((tblFinalData.GSTRatio) Is Null));

Could I, as an alternative, run an update query in code? I've just never
been very good at the proper formation of this sort of coding.

All help is greatly appreciated.

Thanks,

JR
 
G

Guest

Choose the menu Tools, then Options. On the "Edit/Find" tab of the dialog
box that comes up, you'll see a check box labeled "Action Queries" inside a
box called "Confirm". If you turn that off, Access will no longer ask you if
you want to run an action query.

If you want to temporarily turn it off in the code, but don't want to turn
it off in general, you can use:

DoCmd.SetWarnings False

Then set it back to true after running your queries.

There's another way to do the same thing, which involves accessing the
Applicatino.SetOption & .GetOption methods. It's a bit lower level, but lets
you handle the situation with a bit more finess.
 
G

giorgio rancati

Hi JR,

You can make only one query
The MyQuery sql Code
----
UPDATE MyTable
SET Field1=IIF(IsNull(Field1),0,Field1),
Field2=IIF(IsNull(Field2),0,Field2),
Field3=IIF(IsNull(Field3),0,Field3),
Field4=IIF(IsNull(Field4),0,Field4),
Field5=IIF(IsNull(Field5),0,Field5),
Field6=IIF(IsNull(Field6),0,Field6)
 

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