Invalid Use of Null Error on Loading Report (1 Viewer)

Damo1412

Registered User.
Local time
, 22:46
Joined
Nov 15, 2010
Messages
65
Hi,

I am developing a database for my company which will produce reports based on data entered on various forms.

When the report opens, I would like its name to dynamically change to include the site, the client and their reference number. Although I know very little VBA, from searching this and other forums I have managed to get this to work on other forms.

On a different form, I have managed this by giving the form the caption "Caption" and then running the following code on load:
Code:
Reports("ItemisedQuoteFromQuoteFromViewSalesEnquiryFromSearch").Caption = "Our Quotation Ref: " & [StaffInitials] & "/" & [QuoteEnteredBy] & "/" & [QuotesJobsSalesEnquiryRecordNumber] & " - " & [ClientDetailsName] & " reference " & [JobsClientJobNumber]
Which will give the report a title along the lines of: "Our Quotation Ref: AB/CD/123456 - Client Name reference 987654".


On the report I am struggling with the code is:
Code:
Reports("MWUPropertyAssessment").Caption = "Property Assessment for " & [SiteDetailsAddressLine1] & ", " & [ClientDetailsName] & " reference: " & [PropertyAssessmentClientJobNumber]
However all this produces is "Property Assessment for , reference". If I try entering just "[SiteDetailsAddressLine1]", "[ClientDetailsName]" or "[PropertyAssessmentClientJobNumber]" I receive an Invalid use of Null error message.

If I create text boxes on the report for [SiteDetailsAddressLine1], [ClientDetailsName] and [PropertyAssessmentClientJobNumber] they are filled with the correct information so I know that these fields are not blank.

Can anyone please tell me where I am going wrong.

Many thanks,
 

GohDiamond

"Access- Imagineer that!"
Local time
Today, 01:46
Joined
Nov 1, 2006
Messages
550
Place the fields SiteDetailsAddressLine1, ClientDetailsName, PropertyAssessmentClientJobNumber somewhere on the report layout for the report named "MWUPropertyAssessment"

Make the field property VISIBLE = NO for each field

In the Report_Load event enter your statement
Reports("MWUPropertyAssessment").Caption = "Property Assessment for " & [SiteDetailsAddressLine1] & ", " & [ClientDetailsName] & " reference: " & [PropertyAssessmentClientJobNumber]

Things should appear in the Title Bar of the report as usual.



Cheers!
Goh
 

Attachments

  • report_title.JPG
    report_title.JPG
    14.3 KB · Views: 206

Damo1412

Registered User.
Local time
, 22:46
Joined
Nov 15, 2010
Messages
65
Hi Goh,

Thank you so much for your help, this worked absolutely perfectly.

Thanks again,

Damian
 

Users who are viewing this thread

Top Bottom