fRefreshLinks Doesn't work if path doesn't exist 
Author Message
 fRefreshLinks Doesn't work if path doesn't exist

I am linking my tables through code using fRefreshLinks
from Dev's website. Everything works fine except when I
move the database to another computer I get bad file name
or number error when using:
If Len(Dir(strDBPath)) = 0 Then
'File Doesn't Exist, call GetOpenFileName
            strDBPath = fGetMDBName(strDBPath)
            If strDBPath = vbNullString Then
                'User pressed cancel
                Err.Raise cERR_USERCANCEL
            End If
        End If
The path no longer exists and I'm not sure how to get
around this.

Chris



Sat, 18 Jun 2005 14:19:29 GMT  
 fRefreshLinks Doesn't work if path doesn't exist
A File Open dialog should be displayed.  You are expected to find the file
containing the tables.  If the you can not locate the file, an error is
raised.  How you handle the error is up to you. If you get the error, it is
probably best to quit the app (programmatically).  Most apps will not
function properly with invalid table links.


Quote:
> I am linking my tables through code using fRefreshLinks
> from Dev's website. Everything works fine except when I
> move the database to another computer I get bad file name
> or number error when using:
> If Len(Dir(strDBPath)) = 0 Then
> 'File Doesn't Exist, call GetOpenFileName
>             strDBPath = fGetMDBName(strDBPath)
>             If strDBPath = vbNullString Then
>                 'User pressed cancel
>                 Err.Raise cERR_USERCANCEL
>             End If
>         End If
> The path no longer exists and I'm not sure how to get
> around this.

> Chris



Sat, 18 Jun 2005 15:56:00 GMT  
 fRefreshLinks Doesn't work if path doesn't exist
Yes, I know a file open dialog should be displayed but it
is only displayed when using a computer on the network.  
If I switch to a computer that can't see the existing
path I get the error.  The path is
\\Chris\Databases\DatabaseBackend.  On a non-networked
computer I get the error.  I would like the Open dialog
window to display so that I can choose
c:\Databases\DatabaseBackend.  

Thanks for replying.

Chris

Quote:
>-----Original Message-----
>A File Open dialog should be displayed.  You are

expected to find the file
Quote:
>containing the tables.  If the you can not locate the
file, an error is
>raised.  How you handle the error is up to you. If you

get the error, it is
Quote:
>probably best to quit the app (programmatically).  Most
apps will not
>function properly with invalid table links.



>> I am linking my tables through code using fRefreshLinks
>> from Dev's website. Everything works fine except when I
>> move the database to another computer I get bad file
name
>> or number error when using:
>> If Len(Dir(strDBPath)) = 0 Then
>> 'File Doesn't Exist, call GetOpenFileName
>>             strDBPath = fGetMDBName(strDBPath)
>>             If strDBPath = vbNullString Then
>>                 'User pressed cancel
>>                 Err.Raise cERR_USERCANCEL
>>             End If
>>         End If
>> The path no longer exists and I'm not sure how to get
>> around this.

>> Chris

>.



Sat, 18 Jun 2005 23:23:07 GMT  
 fRefreshLinks Doesn't work if path doesn't exist
From the look of it, you're going to raise an error if strDBPath is
not a valid path at the time you say

    > If Len(Dir(strDBPath)) = 0 Then

This routine has error-handling, doesn't it?  You may want to do
something like this:

    Dim strWork As String

    On Error Resume Next
    strWork = vbNullString
    strWork = Dir(strDBPath)
    On Error GoTo ...  ' original error-handler

    If Len(strWork) = 0 Then
        'File Doesn't Exist, call GetOpenFileName

        ' ... and so on

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


Quote:
> I am linking my tables through code using fRefreshLinks
> from Dev's website. Everything works fine except when I
> move the database to another computer I get bad file name
> or number error when using:
> If Len(Dir(strDBPath)) = 0 Then
> 'File Doesn't Exist, call GetOpenFileName
>             strDBPath = fGetMDBName(strDBPath)
>             If strDBPath = vbNullString Then
>                 'User pressed cancel
>                 Err.Raise cERR_USERCANCEL
>             End If
>         End If
> The path no longer exists and I'm not sure how to get
> around this.

> Chris



Mon, 20 Jun 2005 13:34:08 GMT  
 fRefreshLinks Doesn't work if path doesn't exist
Thanks so much, that was so simple.  I am using error
trapping, but I didn't realize to trap for that.  I
trapped for error 52--Bad name or number and everything
seems to work.  Of course I will have to test it
properly, but it appears my problem is solved.

Chris

Quote:
>-----Original Message-----
>From the look of it, you're going to raise an error if
strDBPath is
>not a valid path at the time you say

>    > If Len(Dir(strDBPath)) = 0 Then

>This routine has error-handling, doesn't it?  You may
want to do
>something like this:

>    Dim strWork As String

>    On Error Resume Next
>    strWork = vbNullString
>    strWork = Dir(strDBPath)
>    On Error GoTo ...  ' original error-handler

>    If Len(strWork) = 0 Then
>        'File Doesn't Exist, call GetOpenFileName

>        ' ... and so on

>--
>Dirk Goldgar, MS Access MVP
>www.datagnostics.com

>(please reply to the newsgroup)



>> I am linking my tables through code using fRefreshLinks
>> from Dev's website. Everything works fine except when I
>> move the database to another computer I get bad file
name
>> or number error when using:
>> If Len(Dir(strDBPath)) = 0 Then
>> 'File Doesn't Exist, call GetOpenFileName
>>             strDBPath = fGetMDBName(strDBPath)
>>             If strDBPath = vbNullString Then
>>                 'User pressed cancel
>>                 Err.Raise cERR_USERCANCEL
>>             End If
>>         End If
>> The path no longer exists and I'm not sure how to get
>> around this.

>> Chris

>.



Tue, 21 Jun 2005 02:15:56 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. asyncread doesn't tell if file doesn't exists

2. Check if a table exist doesn't work

3. Chdir doesn't work with UNC path

4. Chdir doesn't work with UNC path

5. Form_Load() doesn't execute, form doesn't load

6. files exists or not - says that it doesn't exist

7. class doesn't support automation or doesn't support expected interface

8. 'Next Comment' doesn't work

9. Doesen't doesn't exist

10. Code doesn't work (from Dev's site)

11. WebResponse Webbot Doesn't work with ASP's

12. You'd think this works, but it doesn't

 

 
Powered by phpBB® Forum Software