Thread: Set Warnings False?????
12-02-14, 13:58 #1Registered User
- Join Date
- Jun 2014
Unanswered: Set Warnings False?????
I have a split DB where multiple users are accessing the front end and storing data into the back end. In several forms I have append queries set up through buttons and have the "Set Warnings" option to False for each one of them. When I use the forms and click the buttons to run the append queries I have no problems. No warnings pop up. There are several users where this is not the case though, they get the warning messages when they run the append queries. Why does this happen and how can I fix it? Any help would be much appreciated.
12-03-14, 02:22 #2Moderator
Provided Answers: 14
- Join Date
- Mar 2009
Instead of using OpenQuery or another DoCmd macro-like command, you can use the Execute method of the CurrentDb object.
a) You convert all queries to dynamic queries. Suppose that now you have a Query named Query1, like this:
UPDATE [SomeTable] SET [ColumnX] = 'SomeValue' WHERE [ColumnY] = 'SomeCriteriaValue';
Private Sub CommandButton_Click () Dim stDocName As String stDocName = "Query2" DoCmd.SetWarnings False DoCmd.OpenQuery stDocName, acNormal, acEdit DoCmd.SetWarnings True End Sub
Private Sub CommandButton_Click () ' Dim stDocName As String ' ' stDocName = "Query2" ' DoCmd.SetWarnings False ' DoCmd.OpenQuery stDocName, acNormal, acEdit ' DoCmd.SetWarnings True Dim strSQL As String strSQL = "UPDATE [SomeTable] SET [ColumnX] = 'SomeValue' WHERE [ColumnY] = 'SomeCriteriaValue';" CurrentDb.Execute strSQL, dbFailOnError End Sub
Private Sub CommandButton_Click () ' Dim stDocName As String ' ' stDocName = "Query2" ' DoCmd.SetWarnings False ' DoCmd.OpenQuery stDocName, acNormal, acEdit ' DoCmd.SetWarnings True Dim qdf As DAO.QueryDef Dim strSQL As String Set qdf = CurrentDb.QueryDefs("Query2") strSQL = qdf.SQL CurrentDb.Execute strSQL, dbFailOnError qdf.Close Set qdf = Nothing End SubHave a nice day!
12-03-14, 16:49 #3Moderator
Provided Answers: 19
- Join Date
- Jun 2005
- Richmond, Virginia USA
If the former is true, there is no limit to the kinds of problems you can encounter, including that which is now occurring.
Linq ;0)>Hope this helps!
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007