Message box (1 Viewer)

nate0057

Registered User.
Local time
Today, 00:18
Joined
Oct 4, 2012
Messages
74
Hi there,

I have a report named Link_report which retrieve links to find some documents. I would like to add a Msgbox to say: " No link has been found for this document" when the case link is empty.

Could you tell me how?

Thank you
 

NeutronFlux

Registered User.
Local time
Today, 03:18
Joined
Aug 20, 2012
Messages
78
One way is to have a textbox in the report footer that counts the number of links in the report. You can do this simply by typing into the textbox control source:
Code:
=count([NameOfLinkField])
Then for the OnLoad event for your report, you can have something like:
Code:
Private Sub Report_Load()
    If Me.txtCount = 0 Then MsgBox "No link has been found for this document"
End Sub
 

nate0057

Registered User.
Local time
Today, 00:18
Joined
Oct 4, 2012
Messages
74
One way is to have a textbox in the report footer that counts the number of links in the report. You can do this simply by typing into the textbox control source:
Code:
=count([NameOfLinkField])
Then for the OnLoad event for your report, you can have something like:
Code:
Private Sub Report_Load()
    If Me.txtCount = 0 Then MsgBox "No link has been found for this document"
End Sub

I cannot write it on the control source because I've already something in!
 

NeutronFlux

Registered User.
Local time
Today, 03:18
Joined
Aug 20, 2012
Messages
78
I mean, create a new textbox. Change the control source for the new textbox.
 

NeutronFlux

Registered User.
Local time
Today, 03:18
Joined
Aug 20, 2012
Messages
78
I guess I should have clarified... change NameOfLinkField to the actual name of the field or textbox for links. I called it that because I don't know what the name of your field or control is. Oh, and to clarify, make sure the name of the new control box is also the same as the one in VBA. For instance, I used "txtCount". If you want to follow my example exactly, name that new textbox as txtCount.
 

nate0057

Registered User.
Local time
Today, 00:18
Joined
Oct 4, 2012
Messages
74
The textbox Noameoflinlkfield still appears and when I say Ok, a message error appears: You entred an expression that has no value"
 

NeutronFlux

Registered User.
Local time
Today, 03:18
Joined
Aug 20, 2012
Messages
78
The textbox Noameoflinlkfield still appears and when I say Ok, a message error appears: You entred an expression that has no value"

Did you save? If not, your changes may not be reflected. Otherwise, you need to change nameoflinkfield to the actual name of your field as I said in a previous post. Specifically, change the control source:
Code:
=Count([NameOfLinkField])
Change that NameOfLinkField to your own field name. NameOfLinkField is just a place-holder I used because I don't know the name you used for your links. The message box is popping up because you're telling Access to count the number of NameOfLinkField when there's no such item.
 

nate0057

Registered User.
Local time
Today, 00:18
Joined
Oct 4, 2012
Messages
74
Same error: You entred an expression that has no value
The thing is that I have no value. Indeed when I have a link it appears on the textbox named linksassociated, but when I don't have link I have no value! And i would like to have a message box to tell me that!
 

Users who are viewing this thread

Top Bottom