Action Query Message

N

Nick

I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub
 
A

Allen Browne

If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders-Temp-Date",
dbFailOnError
That way you don't get any confirmation message, but you do get to hear
about it if there is an error.
 
N

Nick

Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders-Temp- Date",
dbFailOnError
That way you don't get any confirmation message, but you do get to hear
about it if there is an error.

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

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

I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub


.
 
A

Allen Browne

With the Execute method, you do not get any warning unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox() to get the user
confirmation before you execute the query. Alternatively, you could wrap the
deletion in a transaction, and get user confirmation before committing the
transaction. If you want to go that way, there are several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html

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

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

Nick said:
Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders-Temp- Date",
dbFailOnError
That way you don't get any confirmation message, but you do get to hear
about it if there is an error.


I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub
 
N

Nick

Not exactly, I try to put it another way.
When you go to Tools : Options : Edit/Find : Confirm and
then un-check Action Query that is what I would like to
achieve. I tried to get help on this before but I don't
think I asked the right question. I think that I need to
run some code with my autoexec macro but what code is the
question.

Thanks for your patience.

Nick
-----Original Message-----
With the Execute method, you do not get any warning unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox() to get the user
confirmation before you execute the query. Alternatively, you could wrap the
deletion in a transaction, and get user confirmation before committing the
transaction. If you want to go that way, there are several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html

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

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

Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders-
Temp-
Date",
dbFailOnError
That way you don't get any confirmation message, but you do get to hear
about it if there is an error.


I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub


.
 
A

Allen Browne

If you want to make sure that setting is off, try this to your startup code:

If Application.GetOption("Confirm Action Queries") Then
Application.SetOption ("Confirm Action Queries"), False
End If

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

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

Nick said:
Not exactly, I try to put it another way.
When you go to Tools : Options : Edit/Find : Confirm and
then un-check Action Query that is what I would like to
achieve. I tried to get help on this before but I don't
think I asked the right question. I think that I need to
run some code with my autoexec macro but what code is the
question.

Thanks for your patience.

Nick
-----Original Message-----
With the Execute method, you do not get any warning unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox() to get the user
confirmation before you execute the query. Alternatively, you could wrap the
deletion in a transaction, and get user confirmation before committing the
transaction. If you want to go that way, there are several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html


Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also
use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders- Temp-
Date",
dbFailOnError
That way you don't get any confirmation message, but you
do get to hear
about it if there is an error.


message
I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I
need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub
 
N

Nick

I have set up a module with the code you suggested, as I
don't have any start-up code, just the autoexec macro. I
am not sure where to go after this.

Nick

-----Original Message-----
If you want to make sure that setting is off, try this to your startup code:

If Application.GetOption("Confirm Action Queries") Then
Application.SetOption ("Confirm Action Queries"), False
End If

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

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

Not exactly, I try to put it another way.
When you go to Tools : Options : Edit/Find : Confirm and
then un-check Action Query that is what I would like to
achieve. I tried to get help on this before but I don't
think I asked the right question. I think that I need to
run some code with my autoexec macro but what code is the
question.

Thanks for your patience.

Nick
-----Original Message-----
With the Execute method, you do not get any warning unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox()
to
get the user
confirmation before you execute the query.
Alternatively,
you could wrap the
deletion in a transaction, and get user confirmation before committing the
transaction. If you want to go that way, there are several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html


Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also
use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders- Temp-
Date",
dbFailOnError
That way you don't get any confirmation message, but you
do get to hear
about it if there is an error.


message
I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I
need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub


.
 
A

Allen Browne

In your module, create a function containing your startup code, e.g.:
Public Function Init()
'code in here.
End Function

In your macro, use the RunCode action to call the function.

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

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

Nick said:
I have set up a module with the code you suggested, as I
don't have any start-up code, just the autoexec macro. I
am not sure where to go after this.

Nick

-----Original Message-----
If you want to make sure that setting is off, try this to your startup code:

If Application.GetOption("Confirm Action Queries") Then
Application.SetOption ("Confirm Action Queries"), False
End If


Not exactly, I try to put it another way.
When you go to Tools : Options : Edit/Find : Confirm and
then un-check Action Query that is what I would like to
achieve. I tried to get help on this before but I don't
think I asked the right question. I think that I need to
run some code with my autoexec macro but what code is the
question.

Thanks for your patience.

Nick

-----Original Message-----
With the Execute method, you do not get any warning
unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox() to
get the user
confirmation before you execute the query. Alternatively,
you could wrap the
deletion in a transaction, and get user confirmation
before committing the
transaction. If you want to go that way, there are
several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html


message
Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted
the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also
use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders-
Temp-
Date",
dbFailOnError
That way you don't get any confirmation message, but you
do get to hear
about it if there is an error.


message
I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want
to
carry out this action. Can anyone show me what code I
need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub
 
N

Nick

Success!
Allen, again I thank you for your patience.
With your help I have finely achieved it and actually
looking back it is amazing how close I was with others
helping but just couldn't get it going. You really explain
things in a way that is easy to follow.

Nick
-----Original Message-----
If you want to make sure that setting is off, try this to your startup code:

If Application.GetOption("Confirm Action Queries") Then
Application.SetOption ("Confirm Action Queries"), False
End If

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

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

Not exactly, I try to put it another way.
When you go to Tools : Options : Edit/Find : Confirm and
then un-check Action Query that is what I would like to
achieve. I tried to get help on this before but I don't
think I asked the right question. I think that I need to
run some code with my autoexec macro but what code is the
question.

Thanks for your patience.

Nick
-----Original Message-----
With the Execute method, you do not get any warning unless something goes
wrong with the deletion. Isn't that what you wanted?

If you did want a confirmation, you could use MsgBox()
to
get the user
confirmation before you execute the query.
Alternatively,
you could wrap the
deletion in a transaction, and get user confirmation before committing the
transaction. If you want to go that way, there are several things to be
aware of. See the example of transactions in this article:
http://members.iinet.net.au/~allenbrowne/ser-37.html


Thanks for your help.
This has taken care of the action query but it has also
stopped the deletion warning, which is not what I would
like to happen. Maybe I am applying it wrong. I pasted the
code you recomended after the line, On Error GoTo
Err_Re_Date_Click.
Can you please point me in the right direction?

Regards
Nick
-----Original Message-----
If this is an action query, you could suppress it with:
DoCmd.SetWarnings False
Don't forget to turn it back on again.

Unless there are parameters in the query, you could also
use:
dbEngine(0)(0).Execute "qyOrders-Update_tbOrders- Temp-
Date",
dbFailOnError
That way you don't get any confirmation message, but you
do get to hear
about it if there is an error.


message
I have an Event Procedure below which works, however a
message box appears to confirm whether or not I want to
carry out this action. Can anyone show me what code I
need
to use to suppress this message?
Assistance is greatly appreciated.

Nick

Private Sub Re_Date_Click()
On Error GoTo Err_Re_Date_Click

Dim stDocName As String

stDocName = "qyOrders-Update_tbOrders-Temp-Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Me![Orders-sub1].Requery

Exit_Re_Date_Click:
Exit Sub

Err_Re_Date_Click:
MsgBox Err.Description
Resume Exit_Re_Date_Click

End Sub


.
 

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