I have an Access/Jet app with a ton of VBA, and a few particular funcitons are giving me trouble.
We have a part of this program where we can link a file name (with the full path) to an order. This works well most of the time. This gives us a record of what datafiles were used.
Recently, we had another department start using the Link function to link /their/ files on the network (original documents, design files, that sort of thing). The problem is that not everyone has at least read access to these files - and when the form loads and checks the file names, if the current user does not have access to that file, Dir throws a "Bad file name or number" error.
Does anyone have any solution to this aside from giving everyone read access to everything? The builtin Access non-help is about as helpful as usual - any suggestions?
~KJ
4 4029
I have an Access/Jet app with a ton of VBA, and a few particular funcitons are giving me trouble.
We have a part of this program where we can link a file name (with the full path) to an order. This works well most of the time. This gives us a record of what datafiles were used.
Recently, we had another department start using the Link function to link /their/ files on the network (original documents, design files, that sort of thing). The problem is that not everyone has at least read access to these files - and when the form loads and checks the file names, if the current user does not have access to that file, Dir throws a "Bad file name or number" error.
Does anyone have any solution to this aside from giving everyone read access to everything? The builtin Access non-help is about as helpful as usual - any suggestions?
~KJ
What exactly are you looking for? - A more descriptive Error Message?
- Resume program execution if the specific Error occurs?
- Stop Program execution?
- Aside from granting Read Access, I do believe you are sort of handcuffed.
What exactly are you looking for? - A more descriptive Error Message?
- Resume program execution if the specific Error occurs?
- Stop Program execution?
- Aside from granting Read Access, I do believe you are sort of handcuffed.
I suppose that if we have to do either read access or continue running, security dictates that we continue running, suppressing error messages unless they try to open the file.
I was hoping someone had done a work around - like ghosting as a read-only user or something similar. The problem is that keeping the error messages is useful if the file doesn't actually exist - I was hoping to only suppress them if the file was not accessible. Which means that it might as well not exist.
Groan.
I hate "fixing" things by screwing with the error handling. It really makes me nervous.
Anyone else?
~KJ
I suppose that if we have to do either read access or continue running, security dictates that we continue running, suppressing error messages unless they try to open the file.
I was hoping someone had done a work around - like ghosting as a read-only user or something similar. The problem is that keeping the error messages is useful if the file doesn't actually exist - I was hoping to only suppress them if the file was not accessible. Which means that it might as well not exist.
Groan.
I hate "fixing" things by screwing with the error handling. It really makes me nervous.
Anyone else?
~KJ
If a File does not exist, or it does exist and the Path to it is incorrect, the Dir() Function will return a Zero Length String. If the File is not accessible, Error Number 52 will be generated - Bad file name or number. Why can't you simply set an Error Trap for Error Number 52, then suppress any Error Message. If the File doesn't exist, simply check for a return value from Dir() of a Zero Length String, then display an Error Message. Will this work in your current situation?
Ahhhh... I thought the error was generated anytime the file couldn't be accessed through the given path, whether it be due to permissions or bad typing. Perhaps I need to check our code again - I apparently was mistaken.
Yes, that helps considerably.
Thank you!
~KJ
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: Falc2199 |
last post by:
Hi,
Does anyone know how to make this work?
var sectionId = 5;
repeat_section_sectionId();
function repeat_section_5(){
alert("firing");
}
|
by: C.E.O. Gargantua |
last post by:
I am using the IBM DB2 Connector class of the Redistributable DB2
Run-Time Client Lite in a c# .net application using Visual Studio.
Running the code:
string myConnString =...
|
by: Dave |
last post by:
I have an Access 2K application that is distributed to about a dozen
users (all with identical NT environments and identical Access
versions, object libraries and service packs). I am using the VBA...
|
by: Lauren Wilson |
last post by:
Hi Folks,
We have a solid, five year old Access app that is suddenly behaving
oddly after conversion to Access 2002/2003 format. Everything seems
to run OK except for a few oddities. The code...
|
by: jay |
last post by:
I am attempting to impersonate an account in ASPNET. I am using
aspnet_setreg to store the username and passwords. I have given the
ASPNET account permisision to read the registry values. However,...
|
by: Jess |
last post by:
Hello,
It is said that if I implement a "swap" member function, then it
should never throw any exception. However, if I implement "swap" non-
member function, then the restriction doesn't...
|
by: Matt |
last post by:
Hi friends,
Okay so well, I have quite a problem right now with a file stream. What
I am doing is to use the Cannon SDK dlls to get control over my old
Cannon A60 Camera for some surveillance...
|
by: sbasavar |
last post by:
Hi All,
In my excel programming, I am using XML http object (MSXML2.XMLHTTP.3.0).
Using this object when I try to send a request application throws an "Access
is Denied" error. Strange thing...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |