>Is there any way of ensuring a network connection is mapped before I try to append a record to a table on that drive?
>
>I have an app, and although it doesn't error the user is complaining that some records do not seem to have saved.
>
>I would assume that if I tried to append to a file that could not be accessed it would give me an error.
>
>I would like to call some code to remap the drive before I append just to cover myself.
>
>
>Any help would be much appreciated.
There are a number of ways to do this. You could use GetLogicalDrives() or GetLogicalDriveStrings() from the API to find the mapped drives, then, as was mentioned, use the API to connect if necessary. The native DRIVETYPE() function will return a 0 if the type is unknown or not in use. I prefer the Windows Script Host.
oNet = CREATEOBJECT("WScript.NetWork")
oDrives = oNet.EnumNetworkDrives()
FOR lni = 0 TO oDrives.Count - 1
llfound = (oDrives.Item(lni) = tcDrive)
NEXT
IF NOT llfound
oNet.MapNetworkDrive(tcDrive, tcShare)
ENDIF
George
Ubi caritas et amor, deus ibi est