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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba - save/replace not working - docmd.setwarnings

Status
Not open for further replies.

arpeggione

Programmer
Nov 23, 2005
99
US
Hi: I am using a "Save As" in Access vba. I want to automatically overwrite the current file - eliminate the msg. I've tried Docmd.Setwarnings False, docmd.setwarnings (False) and application.setoption "Confirm Document Deletions", 0. After my "SaveAs" command, I set command back to True or 1.

With all three of these, I STILL get the "Replace with?" message.

any ideas?

Thank you in advance!

Karen
 
Try turning off your warnings.

I don't know if the wording is the same in Access, but in Excel VBA its Application.DisplayAlerts = False.
 
To UnsolvedCoding:

any ideas? anyone else? thanks!

Here are a couple versions of my code:

Version 1:
Application.DoCmd.SetWarnings (False)
activeworkbook.SaveAs FileName:=myFileName, FileFormat:=xlNormal, ReadOnlyRecommended:=False
activeworkbook.Close
Application.DoCmd.SetWarnings (True)

Version 2:
Application.DoCmd.SetWarnings False
activeworkbook.SaveAs FileName:=myFileName, FileFormat:=xlNormal, ReadOnlyRecommended:=False
activeworkbook.Close
Application.DoCmd.SetWarnings True

Version 3:
Application.SetOption "Confirm Document Deletions", 0
activeworkbook.SaveAs FileName:=myFileName, FileFormat:=xlNormal, ReadOnlyRecommended:=False
activeworkbook.Close
Application.SetOption "Confirm Document Deletions", 1


 
To Unsolved Coding: meaning...I didn't really understand your last post - hope my code will clarify things for you. Let me know...thx, Karen
 
yourXLApplication.DisplayAlerts = False

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
To PHV: Thx for your email...Well....I didn't say, but I tried DisplayAlerts (in several ways) also - didn't work. I believe DisplayAlerts is for EXCEL vba and the SetWarnings is for Access. I may be wrong....let me know.

To MSCallisto - yes, but not in the way you are thinking. I am a flute player and have played the Arpeggione Sonata by Schubert - I liked it so much, it stuck with me....thx for asking! How about you?

karen
 
Long ago I was a fan of "Zena Warrior Princess" and liked her arch enemy "Callisto" played by Heidi Hudson Leick. Callisto was taken as a Tek-Tip handle so I chose mscallisto.

Sam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top