Penn 227
penn227 at yahoo.com
Tue May 3 09:44:19 CDT 2005
Jim, Thank you for the code snippet. Since the DevFile.txt is only on my computer (not the end user's), I only change it's name to confirm that the program will work as expected on the user's computer. Consequently, there's no need to be able to do it from within the Access program. The author of the aritcle I referenced below also uses the presence or absence of the DevFile.txt file to "turn on or off various environment variables such as the AllowBypassKey, AllowSpecialKeys, AllowFullMenus..." Since he, and I, deploy our programs as *.mde files, I don't see what the advantage would be to be able to turn these back on at the user's site. Who wants to use Alt-F11 to bring up the VBA code window in an mde file except some nosy busybody? I use another program (http://www.rogersaccesslibrary.com/Otherdownload.asp?SampleName='SetDatabaseProperties.mdb') to turn off these environment variables just before deployment so I am currently only using the DevFile.txt in the Error Handler. I may decide to hook this up to the presence or absence of the DevFile.txt but I haven't yet. Penn ----- Original Message ----- > If you are running part of the process in Access why not rename the file > in > code as well? Something like this code snippet I use to rename files in > one > of my programs. > Jim Hale > > strFilename = GetNamePart_TSB(strpath2) 'get old file name > 'create new filename > strFileSave = ReplaceString(strpath2, ".txt", ".dmp", False) > strFilename = GetNamePart_TSB(strFileSave) 'get name of new file > strDir(2) = Pathnamefile("CLPdata") 'get directory to move to > strPathnew = strDir(2) & strFilename 'path where file will be move to > > Name strpath2 As strFileSave 'rename file > > If FileExists(strPathnew) = True Then Kill strPathnew > Name strFileSave As strPathnew 'move renamed text file to new sub dir > > -----Original Message----- > Jim, > > I'm sorry but I don't understand your comment. > This is running entirely outside of Access. The > reason it's related to Access is that my error > handler checks to see if that file is present under > the name of DevFile.txt. If it isn't present thne > the user is prompted to print the error message > and it is written to a log file. If it is present, > then > a msgbox offers to debug the code. It's a tip I > got from reading Access Security Ideas from > an Experienced Developer > (http://www.vb123.com/toolshed/05_access/accesssprotectionideas.htm). > > I've found it to be an excellent error handler > since all the others I've seen don't give you a > clue about where the runtime error actually occurred. > > Penn > ----- Original Message ----- >> After I create the desired string I use >> Name strpath2 As strFileSave 'rename file >> >> Jim Hale >> >> -----Original Message----- >> From: Penn 227 [mailto:penn227 at yahoo.com] >> Sent: Monday, May 02, 2005 4:10 PM >> To: Access Developers discussion and problem solving >> Subject: [AccessD] OT: Create .bat in WinXP Pro >> >> >> This is completely off topic but I can't find >> any answers on the web and thought perhaps >> someone on the list had experience with it. >> >> I would like to automate renaming >> a file. >> >> I tried writing a batch file but >> it didn't work. >> >> ******* Batch File ****** >> run cmd >> cd c:\ >> ren DevFile.txt DevFileX.txt >> exit >> ***** End ***** >> >> Any ideas greatly appreciated. >> >> Penn __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com