Comiling problems

  • Thread starter Thread starter Leslie Isaacs
  • Start date Start date
L

Leslie Isaacs

Hello All

I have posted a problem this morning on the 'Multi-user' newsgroup, but
there have been further developments that lead me to suspect that the
problem is connected to the compiling of modules. I have copied the original
post to the end of this one in case it is needed.

The 'further development' is that I have just tried going into a module and
selecting debug > compile all modules. This resulted in a 'compile error -
variable not defined' message, with the 'stLinkCriteria' part of the
following function (contained in a Class Module) being highlighted:

Private Sub Command628_Click()
On Error GoTo Err_Command628_Click

Dim stDocName As String

stDocName = "frm select months"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command628_Click:
Exit Sub

Err_Command628_Click:
MsgBox Err.Description
Resume Exit_Command628_Click

End Sub

While in that module, if I click the the Compile Loaded Modules icon, no
errors are reported.

Is it likely that this problem is the cause of a very severe performance
problem that has recently come about (see earlier post, copied below)?

Hope someone can help
Many thanks
Les

My original post was:
I have an A2K 'backend' mdb on one PC, and 4 other
networked PCs each with a 'frontend' mdb that uses linked
tables from the 'backend'.

All has been working fine for over a year now, except that
both the backend and the frontends had become bloated and
would not 'unbloat' much by compacting and repairing. I
tried creating a new mdb and importing the tables from the
backend, and the result was a much smaller mdb, so I did
the same with the frontend, linking the tables from the
new (smaller) backend, and the new frontend was again much
smaller.

So I was happy: until I found that performance has become
inordinately slow - all forms take at least 10 seconds to
open, and many take 1-2 minutes (previously the max was 10
seconds). I have tried compacting, repairing and
refreshing the links using the linked table manager, but
all to no effect.

What's happening - and what can I do?

Many thanks
Les
 
Just wondering, maybe I'm missing something, but where
have you Dim'ed stLinkCriteria, or given it a value?

Private Sub Command628_Click()
On Error GoTo Err_Command628_Click

Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = '****Put filter here.****
stDocName = "frm select months"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command628_Click:
Exit Sub

Err_Command628_Click:
MsgBox Err.Description
Resume Exit_Command628_Click

End Sub
 
Either change the line

DoCmd.OpenForm stDocName, , , stLinkCriteria

to

DoCmd.OpenForm stDocName

or add

Dim stLinkCriteria As String

after

Dim stDocName As String

I'm not sure it's related to your other issue, though.
 
Doug

Thank you for your reply.

I understand that I need to dim the stLinkCriteria or
remove that parameter from the DoCmd.OpenForm command
(seems obvious now!), but why does this syntax error not
come up when I 'compile loaded module'. It only comes up
when I 'compile all modules'. Also I cannot understand how
the syntax error has come about - the code was generated
by access when the command button was created, and I'm
sure I haven't since removed the Dim line (not
intentionally, anyway!): any ideas?

I feel I need to understand these issues, so would be very
grateful for your advice. Regarding your comment about the
above problem not necessarily addressing my main issue
(performance problems), I have received a reply to my post
suggesting that I may have lost the relationships and
foreign key indexes when importing the tables into the new
mdb. I will sort that out, but can you think of any other
possible reasons for the performance hit that I have
suffered?

Many thanks for your continued help.
Les.
 
Back
Top