msjtes40.dll

C

Cathy C

I am running an Access 2002 database on a Windows 2K machine. The server is
one of workstations. It has worked fine for a year and a half. Last week it
started crashing after a new record was entered or an existing record was
editted in any of several forms. The error message referenced msjtes40.dll.

I searched the newsgroup and found information about Q317708. I followed the
instructions to reproduce the error and then to resolve it. It worked for a
few records but then the same thing happened.

This machine is not connected to the internet, so I got it online, did all
the Windows 2K critical updates and service pack, as well as all for MSO.
Same problem.

Any other suggestions?

Thanks,
Cathy C
 
A

Allen Browne

Hi Cathy. Sounds like you have done some good research on this,
re-registered the library associated with the crash, and applied Office XP
Service Pack 3. Hopefully you have also applied the JET 4 Service Pack 8? If
not, grab it from support.microsoft.com, the Downloads section.

My guess here is that your database was damaged during one of the crashes,
so here is how you might recover it.

1. Decompile a copy of the database by entering something like this at the
command prompt while Access is not running. It is all one line, and include
the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

2. Compact the database:
Tools | Database Utilities | Compact.

3. Create a new (blank) database:
File | New.

4. Immediately, uncheck the boxes under:
Tools | Options | General | Name AutoCorrect.
Explanation of why:
http://members.iinet.net.au/~allenbrowne/bug-03.html

5. Import everything from the damaged database:
File | Get External | Import

6. Set minimal references, by opening a code window, and choosing:
Tools | References.
More on references:
http://members.iinet.net.au/~allenbrowne/ser-38.html

7. Compile (from the code window):
Debug | Compile.

This gets you a new, rebuilt database.

There is one other issue that could be causing these crashes. Locate any
form that has a subform, and open it in design view. If you do not have a
text box for the foreign key field (the field(s) named in the
LinkChildFields), then add one. You can set the Visible property to No. The
reason is that if the text box is not present, the LinkChildFields refers to
an object of type AccessField, and Access 2002 and 2003 appear to have a bug
in the implementation of this type. By adding an (invisible) text box, they
refer to an object that is a member of the Controls collection, and you do
not trigger the bug.

For other suggestions on avoiding corruption, see:L
http://members.iinet.net.au/~allenbrowne/ser-25.html
 
C

Cathy C

Thanks, Allen. I'll be at the client site Friday and will try these
suggestions then. Will let you know. Appreciate your assistance!
 
C

Cathy C

Allen - there's a new twist. I had asked the client to think about when this
started happening and she was able to associate it with a change of
procedures. Previously, after she entered a new record she would print out a
copy of it, then move on to the next. They decided to eliminate printing this
copy and the crashes started. When she went back to printing a copy, it
didn't crash.

The forms contain a field called Update at the bottom and under Events it
shows that Before Update =AuditTrail(). I can't find anything under Macros
called AuditTrail but I remember this was some code I found through the
newsgroup when I first did the application. It puts the date, time, and user
name in the field of the person who added the record or editted it. Can you
think of anything about such a procedure that would cause it to crash when
the next command before update is print? It works when she prints, but not on
the records that precipitate a crash.

Thanks for your consideration.
Cathy
 
A

Allen Browne

Okay: if printing avoids the crash, you probably want to trace what's in
that code that could affect the issue. For example, does the printing code
force the record to save?

You say that the audit code writes the user name and date into the same
record? If so, double-check this is happeining in Form_BeforeUpdate.
Form_AfterUpdate would only serve to dirty the record again after it's
saved.
 
C

Cathy C

Found the code. See anything that might be causing this?

Function AuditTrail()
'call UserName function
fOSUserName

On Error GoTo Err_Handler

Dim Myform As Form, C As Control, xName As String, HeaderWritten As Boolean,
Header As String
Set Myform = Screen.ActiveForm
HeaderWritten = False

'If new record, record it in audit trail and exit sub.
If Myform.NewRecord = True Then
Myform!UPDATES = "New Record added by " & strUserName & " on " & Now() & "."
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & ""
'Exit Function
End If

Header = "Changes made on " & Now() & " by " & strUserName & ":"

'Check each data entry control for change and record old value of Control.
For Each C In Myform.Controls
'Only check data entry type controls.
Select Case C.ControlType
Case acTextBox, acComboBox, acListBox, acOptionGroup
' Skip Updates field.
If C.NAME <> "UPDATES" Then
'If control had previous value, record previous value.
'Nonblank old value; nonblank current value
If C.Value <> C.OldValue Then
If HeaderWritten = False Then
HeaderWritten = True
If Myform!UPDATES = "" Then
Myform!UPDATES = Header
Else
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & Header
End If
End If
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & _
C.NAME & " - previous value was " & Chr(34) & C.OldValue &
Chr(34) & "; current value is " & Chr(34) & C.Value & Chr(34) & "."
End If

'blank old value; nonblank current value
If IsNull(C.OldValue) Or C.OldValue = "" Then
If Not (IsNull(C.Value)) Or C.OldValue <> "" Then
If HeaderWritten = False Then
HeaderWritten = True
If Myform!UPDATES = "" Then
Myform!UPDATES = Header
Else
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & Header
End If
End If
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & _
C.NAME & " - previous value was blank; current value is " &
Chr(34) & C.Value & Chr(34) & "." ' & C.OldValue
End If
End If

'nonblank old value; blank current value
If IsNull(C.Value) Or C.Value = "" Then
If Not (IsNull(C.Value)) Or C.OldValue <> "" Then
If HeaderWritten = False Then
HeaderWritten = True
If Myform!UPDATES = "" Then
Myform!UPDATES = Header
Else
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & Header
End If
End If
Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & _
C.NAME & " - previous value was " & Chr(34) & C.OldValue &
Chr(34) & "; current value is blank."
End If
End If

End If
End Select
ContinueC:
Next C

'blank line between entries
If HeaderWritten = True Then Myform!UPDATES = Myform!UPDATES & Chr(13) &
Chr(10) & ""

TryNextC:
Exit Function

Err_Handler:
If Err.Number <> 64535 Then
MsgBox "Error #: " & Err.Number & vbCrLf & "Description: " &
Err.Description
Resume TryNextC
End If

If Err.Number = 64535 Then Resume ContinueC
End Function
 
A

Allen Browne

Cathy, you may need to enroll in a course in VBA, or buy some books so you
understand how to set the properties or why it won't compile for you,
 
B

Brendan Reynolds

If Not, Me.NewRecord Then
Is the comma after Not in the original code, or was that just a typo in the
newsgroup post? If it is in the original code, it shouldn't be.

Other than that, there are two properties of the form referred to in this
code, NewRecord, and UpdatedOn. NewRecord is an intrinsic, built-in
property, so it is unlikely that the error message refers to that property.
What about UpdatedOn? That's not an intrinsic property. Does the form have a
field, control, or custom property with that name?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
H

hero

dffffsa
Cathy C said:
Hopefully, this is the last complex Access application I will ever do. If it
will resolve the current problem, I am willing to remove any code associated
with LASTTRAN and let the entry for this field be manual. I was hoping for
some indication that this error message does indeed show that the current
problem is this field. If you're saying it's more complex than this, then I
guess I'm going to have to hire a VBA programmer to examine this error and
determine a solution. I'm frustrated that the application has worked for so
long - after I have grown very cold on it - and now doesn't. Although I have
been working with databases since 1982, my primary expertise is as an
outsourced IT person for smaller non-profits. Thanks for your suggestion
that I study VBA, but as it plays such a minor role in this application, I
don't believe it would be worth my time and effort.
 
B

Brendan Reynolds

Open the form in design view, and choose 'Code' from the 'View' menu. In the
VBA editor, there are two drop-down lists at the top of the window, the one
on the left will display '(General)' when you first open the VBA editor, and
the one on the right will display '(Declarations)'. Select the control name
('LASTTRAN') from the list on the left, then 'AfterUpdate' from the list on
the right. This should display the LASTTRAN_AfterUpdate event procedure. If
you have any trouble, just press Ctrl+F to open the Find dialog, and search
for the code you're looking for, e.g. 'Me.UpdatedOn'.

When you find the 'Me.Updated = Date' line, don't delete it. Comment it out
by placing an apostraphe in front of it ...

'Me.UpdatedOn = Date

.... that way, if something goes wrong or you find you need that line after
all, you can easily recover by uncommenting it again (just take out the
apostraphe).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
B

Brendan Reynolds

Well, there are a couple of things that look a little odd in the code you
posted earlier in the thread ...

Function AuditTrail()
'call UserName function
fOSUserName

If 'fOSUserName' is the function from the Access Web
(http://www.mvps.org/access/api/api0008.htm) then calling it like this,
without assigning its return value to anything, is pointless.

<snip>

Myform!UPDATES = "New Record added by " & strUserName & " on " & Now() & "."

Where is that strUserName variable declared? I don't see anything in the
posted code that declares that variable, or assigns any value to it. And of
course this code will fail if the form referred to by the Myform variable
does not include a field, control, or property named "UPDATES".

<snip>

If C.Value <> C.OldValue Then

The Value property returns a variant, which may be Null. You can not
reliably use equality and inequality operators to compare values that may be
Null.

<snip>

Myform!UPDATES = Myform!UPDATES & Chr(13) & Chr(10) & _
C.NAME & " - previous value was " & Chr(34) & C.OldValue &
Chr(34) & "; current value is " & Chr(34) & C.Value & Chr(34) & "."

VBA is not capitalizing the Name property as it should. This leads me to
suspect that you probably have a field or control named 'NAME' somewhere in
your database. Name (in any combination of upper and lower case) is a
reserved word, and should not be used as a field or control name.

<snip>

If Err.Number = 64535 Then Resume ContinueC

Where did that error number come from? It does not appear to be a VBA error
number. In fact, it looks suspiciously similar to 65535, the maximum upper
limit of the range of valid VBA error numbers. (Note that because a number
is within the range of valid VBA error numbers does not make it an actual
VBA error number - many of the numbers within the range are unused, and
64535 appears to be one of them).

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
A

aaaaaaa

;;;;;;;;;;;;;;;;?
Cathy C said:
This worked fine, but I'm still back to my original problem. I believe
I've isolated it to a problem with a subform ... but the strange thing is
that it all works fine if the operator prints a copy of the record before
going to the next form. The subform works fine by itself; the child link
is SSN and the master link is SS (both social security numbers). Any
thoughts about how to troubleshoot this?

Thanks!
Cathy
 
B

Brendan Reynolds

Cathy, it has been seven days since your last post. In those seven days I
have answered somewhere in the region of 25 to 30 other questions in the
newsgroups, in addition to my own paid work. I can no longer remember what
your problem was. My best guess at this stage would be that there is not a
single problem, but several. I'm afraid I am unable to help you further. I
hope you will find someone else able to do so. Good luck.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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