Function won't work

aiikahn

Registered User.
Local time
Yesterday, 18:16
Joined
Nov 13, 2006
Messages
18
I was wondering if anyone can help me with my dilemma. I have this report which I'd like for it to call a function every time it loads (see codes below):

Private Sub Report_Load()

lblCC.Caption = getSignBlock()

End Sub

This function is from a module I created (which I'm not even sure if I did correctly):

Public Function getSignBlock() As String

Dim strSignBlock As String

strSignBlock = DLookup("CC", "SignBlock", "ID = 1")

getSignBlock = strSignBlock

End Function


The table "SignBlock" is not related to the records generated by the report. Can someone tell me what I'm doing wrong? I would greatly appreciated any help. Thank you!
 
Try moving the code in the On Load event to the On Format event for the section where the label is located or in the report header's On Format event.
 
I was wondering if anyone can help me with my dilemma. I have this report which I'd like for it to call a function every time it loads (see codes below):

Private Sub Report_Load()

lblCC.Caption = getSignBlock()

End Sub

This function is from a module I created (which I'm not even sure if I did correctly):

Public Function getSignBlock() As String

Dim strSignBlock As String

strSignBlock = DLookup("CC", "SignBlock", "ID = 1")

getSignBlock = strSignBlock

End Function


The table "SignBlock" is not related to the records generated by the report. Can someone tell me what I'm doing wrong? I would greatly appreciated any help. Thank you!

Just change the label control to a text box (you can format it to look like a label) and then set the control source to

=getSignBlock()
 
Public Function getSignBlock() As String

Dim strSignBlock As String

strSignBlock = DLookup("CC", "SignBlock", "ID = 1")

getSignBlock = strSignBlock

End Function

what exactly is this trying to do - you are actually looking up the value of field "CC", in table or query "signblock", for record ID 1. - So you will ALWAYS retrieve the same value with this lookup
 

Users who are viewing this thread

Back
Top Bottom