Problem with message box

nate0057

Registered User.
Local time
Today, 10:04
Joined
Oct 4, 2012
Messages
74
Hi there,
I have a report which retrieve some links of documents in the textbox linksassociated.
I would like to have a message box which tell me when the linksassociated has no value " No value for your link".

I tried this:

Code:
If IsEmpty(linksassociated) Then
    MsgBox "No link has been found for this document", vbInformation
    Exit Sub
End If

But nothing is happened. Maybe it's not on the right place...

Could you help me?? Thanks
 
Replace the IsEmpty with Len()..
Code:
If Len(Me.linkassociated & vbNullString) = 0 Then
    Call MsgBox("No Link has been found for this document", vbInformation, "Link Missing")
    Exit Sub
End If
The Len() function returns the Length of the 'String', so if the textbox contains no value or in other words is an empty String (vbNullString or "") then it will return length as 0.. The reason why I have concatenated them together is because of the fact some 'Variants' might have Null values in which case you can use IsNull, but Len(Null) would return a exception, so to capture both Null and Empty Strings we use the above method.. Hope that makes sense..

Also use this Checking mechanism in Form_Current property as it will be triggered on every record movement..
 
I agree with Paul's test (we Paul's stick together). There's some info here that will tell you why IsEmpty didn't do what you expected:

http://www.baldyweb.com/NullEmptyEtc.htm
 
Sorry but it doesn't work, nothing's happened!!
Where I have to put this code? I wrote it on the "Private Sub OP_Click()" parts but I don't think it's right!
 

Users who are viewing this thread

Back
Top Bottom