MsgBox can not display content completely in Access 2003

  • Thread starter Thread starter James via AccessMonster.com
  • Start date Start date
J

James via AccessMonster.com

Hi all,

I developed a database in Access 97. MsgBox works fine in Access 97, but
will only display part of strings (truncated??) in Access 2003 instead of
full of them.

I wonder if MsgBox has length limitation in Access 2003?

Below is the code, Could you please help me to fix it?

Thank you very much in advance.
----------------------------------------------------------------
Set rsTemp = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)

strLastComp = ""
Do While Not rsTemp.EOF
dtmExpiration = rsTemp![ExpirationDate]
varRetVal = DateDiff("d", dtmDate, dtmExpiration)
texp = DatePart("yyyy", dtmExpiration)
tnow = DatePart("yyyy", dtmNow)
strCompany = rsTemp![Company]

strmsg = strmsg + Chr(10) + rsTemp![Company] & "'s maintenance
agreement for " & rsTemp![Product] & " expires in " & varRetVal & " days."
' + Chr(10)

rsTemp.MoveNext
Loop

If strmsg <> "" Then
MsgBox strmsg, vbInformation, "Maintenance Agreement"
End If
 
From ACCESS Help file:

"The maximum length of prompt is approximately 1024 characters, depending on
the width of the characters used."
 
It looks like you need line-continuation (a space and an underline) in your
message string so it will be treated as a single expression:

strmsg = strmsg & Chr(10) & rsTemp![Company] & "'s maintenance" _
& " agreement for " & rsTemp![Product] & " expires in " & varRetVal _
& " days." & Chr(10)
 
Hi Ken,

Yes, you are right.

It seems that MsgBox Prompt does not have this limitation when running
in Access 97. But it is limited by Access 2003. This is the reason why I
can see all of the message in Access 97 while part of them in Access 2003.

Thank you very much!
 
Hi Mark,

Sorry I did not paste my code clearly. It is too long to be pasted in one
line.

Thank you so much anyway.
 
Back
Top