Help - need to change link tables

G

Guest

Hi,
I have been asked at work to have a look at an error coming up on an ACCESS
database. The question was about a command button located on a form which
is suppose to open up a 'linked' database on the 'on click' event procedure.
The problem is that when clicking on this command button on a form it was
coming up with the error : [path name]invalid path, check that the name is
spelt correctly etc etc.

So I went into the command button's event procedure to have a look at the
code, but, as I am not a programmer I could not decipher through the private
sub where I could check/change the filepath the linked table is going to. I
will paste the code of the sub here:

Private Sub cmdOpenDREnterProfile_Click()
On Error GoTo Err_cmdOpenDREnterProfile_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEnterProfile_DirectReport"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenDREnterProfile_Click:
Exit Sub

Err_cmdOpenDREnterProfile_Click:
MsgBox Err.Description
Resume Exit_cmdOpenDREnterProfile_Click
End Sub


I am slowly learning more and more about ACCESS ( much through this help of
this wonderful forum) but I am a bit stumped here and wander if somone could
answer the following:

1. When you click on the event procedure and it brings up VB viewer, there
is often a list of subs (which I assume are seperate commands). Am I write in
assuming that the sub that it automatically tabs to when the event "..." is
clicked is the command it is referring to. For example; if I go into the
properties of a command button and click on the 'On Open' event procedure, do
I assume that the section in the VB editor (or the data between private sub
and... end sub) are the commands to be executived for that event?

If so then the code that I pasted above does not make sense to me, as I am
thinking it is suppose to say something about linking to another database and
it does not.

Hope I am not being confusing.

regards,
Angeline
 
L

Larry Daugherty

Hi Angeline,

I don't see where stLinkCriteria is receiving a value. The error is
probably coming from form frmEnterProfile_DirectReport or some
procedure it calls.

HTH
-
-Larry-
 
V

Van T. Dinh

The code you posted simply opens another the Form named
"frmEnterProfile_DirectReport".

It is possible that the Open or Load Event of the Form
"frmEnterProfile_DirectReport" has some reference the filepath you referred
in your post. Hence you need to check the code in the above Form.
 
G

Guest

Thanks to both of you.

Yes, I found that on checking the code in the form, it linked to a query
which linked to a table from another database. Upon trying to open the linked
table, the same error come up (not recognising the file path). I'm not sure
why but I just re-linked it and it solved the problem.

Thanks so much for your kind assistance.

regards,
Angeline

Van T. Dinh said:
The code you posted simply opens another the Form named
"frmEnterProfile_DirectReport".

It is possible that the Open or Load Event of the Form
"frmEnterProfile_DirectReport" has some reference the filepath you referred
in your post. Hence you need to check the code in the above Form.

--
HTH
Van T. Dinh
MVP (Access)



Angeline said:
Hi,
I have been asked at work to have a look at an error coming up on an ACCESS
database. The question was about a command button located on a form which
is suppose to open up a 'linked' database on the 'on click' event procedure.
The problem is that when clicking on this command button on a form it was
coming up with the error : [path name]invalid path, check that the name is
spelt correctly etc etc.

So I went into the command button's event procedure to have a look at the
code, but, as I am not a programmer I could not decipher through the private
sub where I could check/change the filepath the linked table is going to. I
will paste the code of the sub here:

Private Sub cmdOpenDREnterProfile_Click()
On Error GoTo Err_cmdOpenDREnterProfile_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEnterProfile_DirectReport"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenDREnterProfile_Click:
Exit Sub

Err_cmdOpenDREnterProfile_Click:
MsgBox Err.Description
Resume Exit_cmdOpenDREnterProfile_Click
End Sub


I am slowly learning more and more about ACCESS ( much through this help of
this wonderful forum) but I am a bit stumped here and wander if somone could
answer the following:

1. When you click on the event procedure and it brings up VB viewer, there
is often a list of subs (which I assume are seperate commands). Am I write in
assuming that the sub that it automatically tabs to when the event "..." is
clicked is the command it is referring to. For example; if I go into the
properties of a command button and click on the 'On Open' event procedure, do
I assume that the section in the VB editor (or the data between private sub
and... end sub) are the commands to be executived for that event?

If so then the code that I pasted above does not make sense to me, as I am
thinking it is suppose to say something about linking to another database and
it does not.

Hope I am not being confusing.

regards,
Angeline
 
V

Van T. Dinh

Links can be broken for various reasons. That's why I always re-link (in my
case, mostly ODBC Tables) before I release a new version to users.
 

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

Top