Run-Time Error 2427 You Entered an Expression Which has No Value

Ksabai

Registered User.
Local time
Today, 03:57
Joined
Jul 31, 2017
Messages
104
I have the following Code Which Results in You Entered an Expression Which has No Value

Private Sub Report_Load()
Dim sContNo As String
sContNo = "Buyer" & " " & "GAIE/IMP/" & Format(Me.ContID.Value, "000")
Me.Report.Caption = sContNo
End Sub

There is No Problem when i Compiled, the Problem is only when i run the Access Report.

Can anyone Help.
 
Hit debug and hover over Me.ContID and see what value it contains. Also see what line is throwing the error, just to be sure.
 
It Says "You Entered an Expression Which Has No Value"
 
That error does not mean the value is null but that it is getting no value. So my first guess is that ContID is some calculated control and something is preventing it from getting a value. An example would be that it needs a value from another form and that form is in design view.
If that is correct, what is the control source for ContID? Try adding DoEvents at the beginning of the code.
 
Also not sure if this is a typo but
"Buyer" & " " & "GAIE/IMP/"
is the same as
"Buyer GAIE/IMP/"
 
The Source Control in Sql Table is ContractID, but how do i add DoEvents
 
Your reference needs to be a control on the report, or a field in the underlying record source.
 
The report may have no records when it opens, thus the reference to the control .Value property could raise this error. If report recordsource is a query, I'd ensure that the query returns records first. If there's a filter being applied, same thing. I'll presume there's at least a table of records for the query/report.
If that proves to be the cause, I'd cancel the report opening rather than coercing the variable to be some default value by using Nz or whatever. Also, none of the quote delimited words look like object or variable names (at least they're not declared as such), so why concatenate them?
sContNo = "Buyer GAIE/IMP/" & Format(Me.ContID, "000")
 
I Sorted Out that Line, Now iam having the same error in these Lines


Dim vYr01 As Variant
If IsNull(Me.DtShip01) = True Then
vYr01 = 0
Else
vYr01 = Year(Me.DtShip01)
End If



Iam getting the error at vYr01 = Year(Me.DtShip01)


Any Answers
 
I'd test with IsDate() to make sure it's a date.
 
I Sorted Out that Line, Now iam having the same error in these Lines
I would relook at Micron's post. Ensure that you are returning records before referencing these controls. My guess would be the same in that you are not returning records.
 
isDate() is working fine. Now there are no errors.
 

Users who are viewing this thread

Back
Top Bottom