Accessing network drive through MFC

I a created a network drive on my system and mapped it to Z: drive letter.

Just the explaining the problem I've created a simple program in MFC for accessing MS access 2007 database on Windows7 machine.

CString MyCRecordSet::GetDefaultConnect()
function I have used this as connection string.

ODBC;DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};DSN='';DBQ=Z:\TestFolder\Database1.mdb

Everything is working fine If I run the application normally. But when running the application as "Run as Administrator", I am getting the following error.

Also if I try to use
_access("Z:\TestFolder\Database1.mdb", mode);

api , then this api always return -1 for any mode either 00, 02, 04, or 06.

I think it is related with security in windows for accessing network drive, but not getting what exactly the problem is and how to handle such cases.
That is not a valid C or C++ string:
_access("Z:\TestFolder\Database1.mdb", mode);

Use this instead:
_access("Z:\\TestFolder\\Database1.mdb", mode);
It's a typo. Sorry for this. In actual code I have is correct I have verified that.
Topic archived. No new replies allowed.