Refresh Links 
Author Message
 Refresh Links

I found the code below on The Access Web for Refreshing
Links. I need to modify it to tell it specifically what
database to refresh, not to browse for it. How would I
modify the code to do that? I.E., I want to hard code a
name and path like "C:\DataTables\FiscalYear.mdb"

       Public Function Browse()
       ' Prompts user for back-end database file name.
       On Error GoTo Err_Browse
       Dim strFilename As String
       Dim oDialog As Object
       Set oDialog = [forms]![frmNewDatafile]!
XDialog.Object
       With oDialog   ' Ask for new file location.
         .DialogTitle = "Please Select New Data File"
         .Filter = "Access Database
(*.mdb;*.mda;*.mde;*.mdw)|" & _
         "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
         .FilterIndex = 1
         .ShowOpen
         ' If user responded, put selection into text box
on form.
         If Len(.FileName) > 0 Then _
         [forms]![frmNewDatafile]![txtFileName] = .FileName
       End With

Thank you.



Sun, 27 Mar 2005 02:15:11 GMT  
 Refresh Links
All this code is doing is putting the "filename" (actually, the full path
with filename) in a control named [txtFileName] on a form named
[frmNewDatafile]. It does it by allowing the user to select the file name
through the file browser option.

Just hardcode in the path and use it:
[frmNewDatafile]![txtFileName] = "C:\DataTables\FiscalYear.mdb"

or you could use a variable in place of [frmNewDatafile]![txtFileName]. All
the rest of this code is needed in order to open the file browser dialog box
and to read the info about the selected file.

--
Hoping that this is helpful...
       Ken Snell
<MS ACCESS MVP>


Quote:
> I found the code below on The Access Web for Refreshing
> Links. I need to modify it to tell it specifically what
> database to refresh, not to browse for it. How would I
> modify the code to do that? I.E., I want to hard code a
> name and path like "C:\DataTables\FiscalYear.mdb"

>        Public Function Browse()
>        ' Prompts user for back-end database file name.
>        On Error GoTo Err_Browse
>        Dim strFilename As String
>        Dim oDialog As Object
>        Set oDialog = [forms]![frmNewDatafile]!
> XDialog.Object
>        With oDialog   ' Ask for new file location.
>          .DialogTitle = "Please Select New Data File"
>          .Filter = "Access Database
> (*.mdb;*.mda;*.mde;*.mdw)|" & _
>          "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
>          .FilterIndex = 1
>          .ShowOpen
>          ' If user responded, put selection into text box
> on form.
>          If Len(.FileName) > 0 Then _
>          [forms]![frmNewDatafile]![txtFileName] = .FileName
>        End With

> Thank you.



Sun, 27 Mar 2005 09:51:14 GMT  
 Refresh Links
Thank you; that worked =)

Quote:
>-----Original Message-----
>All this code is doing is putting the "filename"

(actually, the full path
Quote:
>with filename) in a control named [txtFileName] on a form
named
>[frmNewDatafile]. It does it by allowing the user to

select the file name
Quote:
>through the file browser option.

>Just hardcode in the path and use it:
>[frmNewDatafile]![txtFileName]

= "C:\DataTables\FiscalYear.mdb"
Quote:

>or you could use a variable in place of [frmNewDatafile]!
[txtFileName]. All
>the rest of this code is needed in order to open the file
browser dialog box
>and to read the info about the selected file.

>--
>Hoping that this is helpful...
>       Ken Snell
><MS ACCESS MVP>



>> I found the code below on The Access Web for Refreshing
>> Links. I need to modify it to tell it specifically what
>> database to refresh, not to browse for it. How would I
>> modify the code to do that? I.E., I want to hard code a
>> name and path like "C:\DataTables\FiscalYear.mdb"

>>        Public Function Browse()
>>        ' Prompts user for back-end database file name.
>>        On Error GoTo Err_Browse
>>        Dim strFilename As String
>>        Dim oDialog As Object
>>        Set oDialog = [forms]![frmNewDatafile]!
>> XDialog.Object
>>        With oDialog   ' Ask for new file location.
>>          .DialogTitle = "Please Select New Data File"
>>          .Filter = "Access Database
>> (*.mdb;*.mda;*.mde;*.mdw)|" & _
>>          "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
>>          .FilterIndex = 1
>>          .ShowOpen
>>          ' If user responded, put selection into text
box
>> on form.
>>          If Len(.FileName) > 0 Then _
>>          [forms]![frmNewDatafile]![txtFileName]
= .FileName
>>        End With

>> Thank you.

>.



Sun, 27 Mar 2005 23:32:11 GMT  
 Refresh Links
You're welcome.


Quote:
> Thank you; that worked =)

> >-----Original Message-----
> >All this code is doing is putting the "filename"
> (actually, the full path
> >with filename) in a control named [txtFileName] on a form
> named
> >[frmNewDatafile]. It does it by allowing the user to
> select the file name
> >through the file browser option.

> >Just hardcode in the path and use it:
> >[frmNewDatafile]![txtFileName]
> = "C:\DataTables\FiscalYear.mdb"

> >or you could use a variable in place of [frmNewDatafile]!
> [txtFileName]. All
> >the rest of this code is needed in order to open the file
> browser dialog box
> >and to read the info about the selected file.

> >--
> >Hoping that this is helpful...
> >       Ken Snell
> ><MS ACCESS MVP>



> >> I found the code below on The Access Web for Refreshing
> >> Links. I need to modify it to tell it specifically what
> >> database to refresh, not to browse for it. How would I
> >> modify the code to do that? I.E., I want to hard code a
> >> name and path like "C:\DataTables\FiscalYear.mdb"

> >>        Public Function Browse()
> >>        ' Prompts user for back-end database file name.
> >>        On Error GoTo Err_Browse
> >>        Dim strFilename As String
> >>        Dim oDialog As Object
> >>        Set oDialog = [forms]![frmNewDatafile]!
> >> XDialog.Object
> >>        With oDialog   ' Ask for new file location.
> >>          .DialogTitle = "Please Select New Data File"
> >>          .Filter = "Access Database
> >> (*.mdb;*.mda;*.mde;*.mdw)|" & _
> >>          "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
> >>          .FilterIndex = 1
> >>          .ShowOpen
> >>          ' If user responded, put selection into text
> box
> >> on form.
> >>          If Len(.FileName) > 0 Then _
> >>          [forms]![frmNewDatafile]![txtFileName]
> = .FileName
> >>        End With

> >> Thank you.

> >.



Mon, 28 Mar 2005 00:02:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Refresh Link

2. Using VBA code to refresh links

3. refresh link in code or other method

4. Refreshing Link to Excel97 Spreadsheet with Code

5. 97 Dev Handbook refresh links problem

6. Refresh Links

7. Refresh linked/imported tables programmatically

8. Refreshing links to data mdbs of unknown location 95

9. How to Refresh Links in a Run-Time Application

10. Refresh link of attach table

11. Refresh links in Access Database with VB 6.0 SP4

12. Refreshing linked tables in Access 2000

 

 
Powered by phpBB® Forum Software