Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

docmd.setwarnings not working

Status
Not open for further replies.

radder33

IS-IT--Management
Nov 26, 2009
66
DE
I have been using this method for years to run back grouns queries etc for years and for some reason in my current form it is playing up. My code is quite simple.

DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteRowCounters", acViewNormal
DoCmd.OpenQuery "UpdateRowCounter", acViewNormal, acAdd
DoCmd.SetWarnings True

To test it I ran it as

''DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteRowCounters", acViewNormal
DoCmd.OpenQuery "UpdateRowCounter", acViewNormal, acAdd
''DoCmd.SetWarnings True

With the set warnings commented out it runs fine but with them in it does nothing has anyone else seen this or can suggest a solution?
 
Both run fine if I run them from database window individually or from the vba if I have the 'docmd in place only fails when I make the docmd active
 
radder33 said:
[blue]With the set warnings commented out it runs fine but [purple]with them in[/purple] it does nothing ...[/blue]

I assume you expected changes in the appropriate table(s) but none occured. [blue]Are you sure changes should have?[/blue]

What happens if you [blue]single step[/blue] thru the code?

[blue]Your Thoughts? . . .[/blue] ... Can you parse thru?

See Ya . . .

Be sure to see FAQ219-2884 Worthy Reading! [thumbsup2]
Also FAQ181-2886 Worthy Reading! [thumbsup2]
 
If I understand correclty, with docmd.setwarnings in the code, nothing happens. Commenting out both those lines then the queries do in fact produce the desired results. If I have it wrong, please clarify.

I've NEVER seen this with DOCMD but in general when some native code quits working in Access, I first check for missing references.

Secondly, there is always the decompile commandline switch...

Code:
msaccess.exe /decompile c:\test\mydb.accdb

I think I have that ordered right... The order of the command line switch and target Access file matters.

That will remove all the compiled code... Corruptions do happen. Just be sure to compact/repair and compile all modules.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top