Check for valid file name before saving

My form copies a file from one locatin, prompts the user to create a
new name for the file, then saves the file to another location.

is there an easy way to ensure the user has entered a valid file name
(e.g. did not use '/' or "^" or anything like that) so the save does
not fail?  OR, would it be easier to some how set up error handling so
that if the save fails for that reason, i can prompt the user to try
again.

How would i do either of these things?

Thanks,

0
mpfohl
3/13/2007 2:08:39 AM
access.forms 6864 articles. 2 followers. Follow

1 Replies
1819 Views

Similar Articles

[PageSpeed] 54

You must use error handling for this kind of operation, as there are just 
too many things that could go wrong.

Even if the file name is valid, the path may not exist.
Even if the path exists, the disk may be read-only.
Even if the disk allows entries, the user may not have permissions.
Even if the user has permissions, the disk may be full.
etc.
etc.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<mpfohl@hotmail.com> wrote in message
news:1173751719.103960.78060@c51g2000cwc.googlegroups.com...
> My form copies a file from one locatin, prompts the user to create a
> new name for the file, then saves the file to another location.
>
> is there an easy way to ensure the user has entered a valid file name
> (e.g. did not use '/' or "^" or anything like that) so the save does
> not fail?  OR, would it be easier to some how set up error handling so
> that if the save fails for that reason, i can prompt the user to try
> again.
>
> How would i do either of these things?
>
> Thanks 

0
Allen
3/13/2007 2:19:07 AM
Reply:

Similar Artilces:

merge MSN Bill Pay & Checking Acct
I want to merge my checking account with MSN Bill Pay but only see that I can merge MSN Bill Pay with my checking account (i.e., you lose all of your checking account information). Does any one have any suggestions? -- cheers, Tom G ...

populate Keywords with a batch file?
I'd like to know how to create a batch file that can store a key word (including a trailing comma). I'd open an appropriate word.doc, run the batch file, and that keyword and comma would be inserted in the Keywords panel, either preceding any existing keywords there, or appended to any existing keywords there. So if I had multiple batch files, each embedded with their own unique keyword and comma, I could invoke certain ones as desired, one after another, progressively populating my document's keywords panel with multiple keywords all strung together with comma d...

Check names not working for multiple address books / contacts
Hello! I have upgraded from outlook 2003 to outlook 2007, my contacts are stored in pst. I used to be able to search for a name via check names and it displayed me all the results from global address list and from my contacts, but now it only does one. It does not matter which one I set in the checking order, whichever is top will be the one that provides the result. I would like it to show me both results, how would I go about to set that up? Thank you Deana More accurate and complete information would be helpful. The Global Address List is only available to those who c...

How can I delete PART of a .wmv file?
I have recorded an interview. Unfortunately, I didn't properly turn the recording off and I captured an additional 3 hours of my daily life that I don't want to archive with this recording. How can I do that? You need an audio editor A nice piece of freeware like http://audacity.sourceforge.net/ will do -- http://thewelltemperedcomputer.com "kenyadee" wrote: > I have recorded an interview. Unfortunately, I didn't properly turn the > recording off and I captured an additional 3 hours of my daily life that I > don't want to archive ...

Authorizing checks with RMS
I recently removed PCCharge and setup my syetm to work with a preferred merchant provider to allow native processing of credit & debit cards. Since check verification/authorization was handled by PCCharge to Telecheck, check authorization is now not being done. How is check authorization accomplished using a preferred provider? Thanks, Richard Unfortunately, it's not. PC Charge is the only option for check processing in RMS as far as I know. TPI or some other vendor may support it through an add-in, but RMS as shipped has no way of doing both checks and debit... -- -- Gle...

I cannot open Word files for no apparent reason
I can't open files that I've used frequently, recently...then I can't close the blue window! I have to End Task. Possibly it may be the problem below. However, if this doesn't work, please let us know the version of Word and Windows and are they patched fully up to date? Also, are you able to open Word but not the documents? Details were sadly lacking in your post. That's a symptom of a Word Data Key corruption - usually because Word has been running when updates are installed. Run Regedit and expand by double-clicking to the key below. With DATA selecte...

How do I create Check list
1.I am new to excel and want to create a simple check list. I would like to have the first column check boxes and then the following columns discription and notes. Can someone give me a step by step on how to do this. I have created spread sheets but am not familiar with check boxes. 2.Also, Can someone tell me the difference between Access and Excel? Geek 1) Not sure what you're aiming to do with the checkboxes, but if you right click on the toolbar area, you will get a list of available toolbars. You want either the 'forms' toolbox or the 'controls' toolbox. Genera...

Check text field value against underlying table or query of combo box
Hello, I have a form on which the user can enter new records or update existing ones. If the user enters a new record on the form, I would like to have an 'After Update' event on one of the text fields, which is the item# to check if the value entered already exists in the underlying table, tbl_item. How can I call the table from the 'After Update' event of the text field and check for that value in the table? Thanks in advance. Regards, A. Crawford antcraw@swbell.net wrote: >I have a form on which the user can enter new records or update >existing ones. >If the us...

setting a dedicated place to open an "xls" file
Gentlemen, I do work at the office evey day on spread sheets and save to a disk, which I bring home. Is there any way that I can "lock in" a dedicated point to retrieve my files once I have saved them to "c:\documents & Settings\my documents. When I click "Open and go to "A" drive to get the file from the disk that I took home, my computer "remembers" that this was the last place I opened a file from. And when I am in Excel and want to open a file, the computer looks in "a". Thanks Raymond Tools / Options / General Tab - Default File loc...

Linking Chart items to files
Anyone got a clue on how to link each stacked bar(or similar) to a different file, so when someone views the file, he can click on the bar, to get a relevant document on his web-browser/similar(pdf, whatever). Any suggestions? You can write event procedures that determine which point was clicked. Within the procedure you need some kind of lookup to see what document should be launched according to the point which was clicked. Here's an article on chart events: http://www.computorcompanion.com/LPMArticle.asp?ID=221 - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical...

Preventing multiple check boxes from being checked
I have a worksheet with over 20 rows of check boxes with 5 check boxes in each row. (from the forms toolbox) I would like to prevent the user from checking more than one box in each row. Is this possible? BTW, this forum has been a great help. I'm so glad that expert Excel users are so willing to share their wealth of knowledge. Thanks again. Jae Put them in a group box, again from the forms toolbar. Drag the group box onto the sheet, then drag the checkboxes in. -- HTH RP (remove nothere from the email address if mailing direct) "Jae" <Jae@discussions.micro...

ShellExecute() multiple files to open to one instance
I am opening DWG files to AutoDesks TrueView. When i loop to open these files, a new instance is created for each file i open. Is there a way to create a process and send files to it only? Or a registry key in windows i can set to not allow multiple instances of this program? My goal is to open multiples files to one instance of this viewer, it can handle many files at once. Thanks! check if the program has any command line switch or automation interface to reuse an existing instance. -- Regards Sheng Jiang Microsoft Most Valuable Professional in Visual C++ http://www.jiangsheng.net ...

File Path on a report
I want to put the path details of the Access file from which a report was run into the footer of a report. Is this possible and if so how? You can just write those in the footer and it should print on each page of the report. Use the Label command to write it in. "John.bb" wrote: > I want to put the path details of the Access file from which a report was run > into the footer of a report. Is this possible and if so how? If your database is not split then just add a control to your report and set its control source to =CurrentDb().Name If you database is split into a f...

Issues when validating xml in VS2003
I am trying to validate an xml file and schema and when I am trying to validate I am getting the following error. I have been trying to come out with a solution but I have failed so far. The document validates ok in xmlSpy but it fails in VS2003. Is there any article or fix for this? Thnaks in advance. Error: ====== "The Keyref 'Details' cannot find referred key or unique in scope. An error occurred at file:///C:/test1.xml, (7, 4)..\n" XML file: <?xml version="1.0" encoding="UTF-8"?> <Renewals> <Renewal> <Headers> <...

Printing Checks
I'm having a problem printing checks from Money 2003. I have three accounts that come up in one .mny file. Two of the accounts use 3-on-a-page checks and I want the name and address printed on them. One account uses voucher checks and needs to be nudged a little south. When I go to print checks I have to be aware of what account I'm in and change the settings by hand to make sure the checks print correctly. How can I make the check-print settings stick with the account I'm using. It's a pain to have to remember every time. I'm frequently forgetting and screwing up a pag...

offline files
My laptop is set up to connect with the company lan at work. When I take the laptop home, some of my email files are available and some are not. This is aggravating when I'm at a meeting and expect to find the email with the previous minutes, but can't. What can I do? Check your sync settings while online, and make sure it's set to sync *all* the folders you want - and to do so automatically while online every X minutes, and automatically when you close Outlook. Note - non-default folders will need to be setup for offline use manually, and new subfolders will not inherit thos...

how to write and save ini files like some apps do with their ini's
Im working on app that will keep lists of things in a ini file from edit boxes on a dialogs. I already know about CEdit and WritePrivateProfileStrings things. but I need things to be listed like this. also I will add ability to delete. mIRC does this same way with the servers.ini and alias.ini [thing] n0=here n1=food n2=metal n3=hotdogs n4=metals n5=pencils n6=pens n7=paint for your info. Im using MFC to make my program in Visual C++ 6.0. -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,...

local named references in a sheet
Hello! (this may be a repitition of a message I think I succeeded in seding previously, but cant retrieve, so Im trying again. Appologize!) I am trying to copy a sheet with many named references into a new sheet (same workbook), but I want the new sheet to have the references local to it, so I can experiment with different data on the same calculations. The references hold intermediary values. When I try to copy the original sheet, the named references in the copy point to the original sheet. How do I copy it "correctly"? Thanks Hi Michael, > When I try to copy the orig...

Employee Check Format-Graphical
Does anyone know of a TK that shows how to convert one of the employee check from a text report to a graphical report? We do not have Direct deposit, I looked in the Report Downloads from Great Plains and did not see one there either. thanks -- Doug There's no secret here. Just un-check the "Text Report" option in the Report Definition window. And then modify the report so it looks like you want it. This will take some time. The reports don't transfer from text to graphical nicely. "Doug" wrote: > Does anyone know of a TK that shows how to convert...

Can't save file in network or hard disk
Receive new xp last week and running excel 2000. The file has 12 tabs and lots of data linking between tabs. Sporadically, I cannot save the file back on the network, cannot save under another name, and cannot even save on the c:drive. The message is "xxx.xls cannot be accessed. The file may be read only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding". The network is not down and I am not disconnected from the network. I do not encounter this problem with the old nt. Other files have less tabs and less c...

Check Names = "Exchange Server computer is busy..."
Here's what I got: Active Directory on Server 2003 1 Domain Controller also running DNS and WINS No other DNS or WINS servers (I know, I know) Static IP Addresses...NO DHCP Exchange Server 2003 on a member server Client running W2K SP4 Outlook 2000 SP3 Exchange has 4 mailboxes set, but nobody is using it. I'm still testing things out. When I try to connect to Exchange via my Outlook 2000, I get the following message: "The function cannot be performed because the Microsoft Exchange Server computer is busy. Try again later" I've tried it from 3 different client comp...

Comparing Excel Files
Does anyone know about a Macro or Add-in that compares 2 Excel files/sheets in a similar manner to Compare in Word? Thanks. --- Message posted from http://www.ExcelForum.com/ Amr Tabbarah < wrote: > Does anyone know about a Macro or Add-in that compares 2 Excel > files/sheets in a similar manner to Compare in Word? One way is to save two sheets as CSV files and use Word to compare the CSV files. (It's awkward, but it gets the job done.) 1. One method I like is to make a third sheet to show differences an put a formula like this in all cells :- =Sheet1!A1-Sheet2!A1 ....for...

Printing MICR checks
Hello, We are having an issue printing checks on the Select Payables Checks window. When we try to print the checks we receive the error message below: "Warning: You have MICR but are not in a MICR screen. To use MICR, abort this screen and set up security access." The user has access to this screen but I'm not sure what this error message means. There was nothing related to this in the Knowledge Base either. Has anyone else received this error message before and if so how did/do you resolve it? Thanks! The user has the third party mekorma check writing module ...

'C:\Documents...\SBCMSYNC.DLL' is not a valid Office add-in.
Every time I open Outlook 2000 I get the following message: 'C:\Documents and Settings\...path...\Office\SBCMSYNC.DLL' is not a valid Office add-in. It is not listed as an add- in and I cannot find the file anywhere on the computer. It doesn't seem to be affecting anything. I simply click the OK button and carry on. I would like to get rid of the popup as it is very annoying. Any ideas? http://support.microsoft.com/?kbid=235009 -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) O...

File name list in the open dialog box.
In the open dialog box, how to delete the list of files appearing in the file name drag down menu in excel 2007? Not sure where you are finding this list. Do you mean the Recent Documents you see when you click on the Button? You can clear that by setting your MRU list to 0 under Button>Excel Options>Advanced>Display. If you mean the list you see when you go to Button>Open then you will have to set a new default file path to a folder that is empty. Gord Dibben MS Excel MVP On Thu, 4 Mar 2010 09:10:01 -0800, Acs <Acs@discussions.microsoft.com> wrote: ...