fRefreshLinks() issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys

I am successfully using fRefreshLinks() to allow me to specifiy differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user everytime the
applicaiton starts and not only if the current backend database path doesnot
exist.

Any ideas?

Regards
Greg
 
Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function
 
Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg
 
You need to run that when the database starts, and before it tries to read
any data. So, you could nominate an *unbound* form as your startup form in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in your
AutoExec macro.
 
Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the last few
hours trying to get this to work without much luck! This is frustrating as I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg
 
1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.
 
Thanks Allen,

I tried this but it still seems to be running fRefreshlinks even if the FE
is connected to a valid path.

I only want the user to see the prompt if the FE is connected to a BE path
that is not valid.

Any other ideas?

Regards
Greg

Allen Browne said:
1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the last
few
hours trying to get this to work without much luck! This is frustrating as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg
 
Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called "CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in the
Autoexec macro.

When the app is started and the path is ok, I am still getting the prompt as
if it is running fRefreshLinks.

Regards
Greg




Allen Browne said:
1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the last
few
hours trying to get this to work without much luck! This is frustrating as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg
 
To debug what's going on, temporarily add an a single quote to the start of
this line in the IsDataOk() function:
'On Error Resume Next

Now run it, and take note of the error number and message. Does it give you
a give you a clue as to what's wrong?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called "CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in the
Autoexec macro.

When the app is started and the path is ok, I am still getting the prompt
as
if it is running fRefreshLinks.

Regards
Greg




Allen Browne said:
1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named
Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

Lateral said:
Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the
last
few
hours trying to get this to work without much luck! This is frustrating
as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg


:

You need to run that when the database starts, and before it tries to
read
any data. So, you could nominate an *unbound* form as your startup
form
in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in your
AutoExec macro.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg

:

Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function


Hi Guys

I am successfully using fRefreshLinks() to allow me to specifiy
differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user
everytime
the
applicaiton starts and not only if the current backend database
path
doesnot
exist.

Any ideas?

Regards
Greg
 
Hi Allen,

I did as you said that the following error is displayed:

Runtime Error "3078"

The Microsoft Jet database engine cannot find the input table or query
"MyTable". Make sure it exists and its name is spelt correctly.

Allen, should I be replacing "MyTable" with the the name of my table?
Remember that the app is split with a FE and BE.

If I need to specify the name of my BE, do I need to specify the full path?

Thanks
Regards
Greg



Allen Browne said:
To debug what's going on, temporarily add an a single quote to the start of
this line in the IsDataOk() function:
'On Error Resume Next

Now run it, and take note of the error number and message. Does it give you
a give you a clue as to what's wrong?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called "CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in the
Autoexec macro.

When the app is started and the path is ok, I am still getting the prompt
as
if it is running fRefreshLinks.

Regards
Greg




Allen Browne said:
1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named
Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the
last
few
hours trying to get this to work without much luck! This is frustrating
as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg


:

You need to run that when the database starts, and before it tries to
read
any data. So, you could nominate an *unbound* form as your startup
form
in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in your
AutoExec macro.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg

:

Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function


Hi Guys

I am successfully using fRefreshLinks() to allow me to specifiy
differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user
everytime
the
applicaiton starts and not only if the current backend database
path
doesnot
exist.

Any ideas?

Regards
Greg
 
Yes: "MyTable" should be replaced with the name of your table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen,

I did as you said that the following error is displayed:

Runtime Error "3078"

The Microsoft Jet database engine cannot find the input table or query
"MyTable". Make sure it exists and its name is spelt correctly.

Allen, should I be replacing "MyTable" with the the name of my table?
Remember that the app is split with a FE and BE.

If I need to specify the name of my BE, do I need to specify the full
path?

Thanks
Regards
Greg



Allen Browne said:
To debug what's going on, temporarily add an a single quote to the start
of
this line in the IsDataOk() function:
'On Error Resume Next

Now run it, and take note of the error number and message. Does it give
you
a give you a clue as to what's wrong?

Lateral said:
Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called
"CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in
the
Autoexec macro.

When the app is started and the path is ok, I am still getting the
prompt
as
if it is running fRefreshLinks.

Regards
Greg

:

1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named
Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the
last
few
hours trying to get this to work without much luck! This is
frustrating
as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg


:

You need to run that when the database starts, and before it tries
to
read
any data. So, you could nominate an *unbound* form as your startup
form
in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in
your
AutoExec macro.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg

:

Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function


Hi Guys

I am successfully using fRefreshLinks() to allow me to
specifiy
differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user
everytime
the
applicaiton starts and not only if the current backend
database
path
doesnot
exist.
 
Hi Allen,

Thanks for your patience!

I have tried the following:

Set rs = DBEngine(0)(0).OpenRecordset("PIGS2000-012")

Set rs = DBEngine(0)(0).OpenRecordset("c:\pgis\PIGS2000-012")

Set rs = DBEngine(0)(0).OpenRecordset("c:\pigs\PIGS2000-012.mdb")

Set rs = DBEngine(0)(0).OpenRecordset("c:\pigs\database\PIGS2000-000_be")

and I get the same message as before.

The name of the FE is "PIGS2000-012" and the name of the BE is
"PIGS2000-000_be".

What am I doing wrong?

Regards
Greg






Allen Browne said:
Yes: "MyTable" should be replaced with the name of your table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen,

I did as you said that the following error is displayed:

Runtime Error "3078"

The Microsoft Jet database engine cannot find the input table or query
"MyTable". Make sure it exists and its name is spelt correctly.

Allen, should I be replacing "MyTable" with the the name of my table?
Remember that the app is split with a FE and BE.

If I need to specify the name of my BE, do I need to specify the full
path?

Thanks
Regards
Greg



Allen Browne said:
To debug what's going on, temporarily add an a single quote to the start
of
this line in the IsDataOk() function:
'On Error Resume Next

Now run it, and take note of the error number and message. Does it give
you
a give you a clue as to what's wrong?

Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called
"CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in
the
Autoexec macro.

When the app is started and the path is ok, I am still getting the
prompt
as
if it is running fRefreshLinks.

Regards
Greg

:

1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named
Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the
last
few
hours trying to get this to work without much luck! This is
frustrating
as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg


:

You need to run that when the database starts, and before it tries
to
read
any data. So, you could nominate an *unbound* form as your startup
form
in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in
your
AutoExec macro.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg

:

Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function


Hi Guys

I am successfully using fRefreshLinks() to allow me to
specifiy
differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user
everytime
the
applicaiton starts and not only if the current backend
database
path
doesnot
exist.
 
Hi Allen

I figured out what I was doing wrong!

I was specifying the name of my database when I should have been specifying
the name of one of the tables in the database...

All working!

Thanks again for your help

Regards
Greg

Allen Browne said:
Yes: "MyTable" should be replaced with the name of your table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Lateral said:
Hi Allen,

I did as you said that the following error is displayed:

Runtime Error "3078"

The Microsoft Jet database engine cannot find the input table or query
"MyTable". Make sure it exists and its name is spelt correctly.

Allen, should I be replacing "MyTable" with the the name of my table?
Remember that the app is split with a FE and BE.

If I need to specify the name of my BE, do I need to specify the full
path?

Thanks
Regards
Greg



Allen Browne said:
To debug what's going on, temporarily add an a single quote to the start
of
this line in the IsDataOk() function:
'On Error Resume Next

Now run it, and take note of the error number and message. Does it give
you
a give you a clue as to what's wrong?

Hi Allen

I have tried the following:

1. I have a module called SYSTEM that contains a number of "standard"
functions and have added a new Public Function called
"CheckPathAvail()".
This contains the following code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

I have also added "IsDataOk()" in the SYSTEM module as well.


2. I then added the "RunCode" =CheckPathAvail() as the first line in
the
Autoexec macro.

When the app is started and the path is ok, I am still getting the
prompt
as
if it is running fRefreshLinks.

Regards
Greg

:

1. Create a new blank form, not bound to any table.

2. Set the On Open property of the form to:
[Event Procedure]
Click the Build button (...) beside this property.
Access opens the code window.

3. Between the "Private Sub..." and "End Sub lines, enter:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

4. Save the form.

5. Go to:
Tools | Start Up
and choose the form you just saved as your startup form.

6. Optional: if you want to start another form (say one named
Switchboard),
change the code at Step 3 to:
If Not IsDataOk() Then
Call fRefreshLinks()
End If
DoCmd.OpenForm "SwitchBoard"

This all assumes that you already have the fRefreshLinks() code in a
standard module.

Hi Allen

I am really confused (I am a "newbie" to Access) and have spent the
last
few
hours trying to get this to work without much luck! This is
frustrating
as
I
know I am missing something very simple.

Is this code:

If Not IsDataOk() Then
Call fRefreshLinks()
End If

to be made as a Macro or a Public Function?

Regards
Greg


:

You need to run that when the database starts, and before it tries
to
read
any data. So, you could nominate an *unbound* form as your startup
form
in:
Tools | StartUp
and put it in the Open event of the form.

Or it would be possible to call it through the RunCode action in
your
AutoExec macro.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Where do I put the following code?

If Not IsDataOk() Then
Call fRefreshLinks()
End If

Regards
Greg

:

Test the database by trying an OpenRecordset().
If that works, don't call fRefreshLinks().

The function below would let you write:
If Not IsDataOk() Then
Call fRefreshLinks()
End If

Private Function IsDataOk() As Boolean
On Error Resume Next
'Return: True if the recordset can be opened, else False.
Dim rs As DAO.Recordset

Set rs = dbEngine(0)(0).OpenRecordset("MyTable")
If Err.Number = 0 Then
IsDataOk = True
rs.Close
End If

Set rs = Nothing
End Function


Hi Guys

I am successfully using fRefreshLinks() to allow me to
specifiy
differing
databases for my application's backend.

The problem is that fRefreshLinks() always prompts the user
everytime
the
applicaiton starts and not only if the current backend
database
path
doesnot
exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top