Run-Time Error 2427 You Entered an Expression Which has No Value (1 Viewer)

Ksabai

Registered User.
Local time
Today, 04:09
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.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:09
Joined
Aug 30, 2003
Messages
36,125
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.
 

Ksabai

Registered User.
Local time
Today, 04:09
Joined
Jul 31, 2017
Messages
104
It Says "You Entered an Expression Which Has No Value"
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 07:09
Joined
May 21, 2018
Messages
8,529
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 07:09
Joined
May 21, 2018
Messages
8,529
Also not sure if this is a typo but
"Buyer" & " " & "GAIE/IMP/"
is the same as
"Buyer GAIE/IMP/"
 

Ksabai

Registered User.
Local time
Today, 04:09
Joined
Jul 31, 2017
Messages
104
The Source Control in Sql Table is ContractID, but how do i add DoEvents
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:09
Joined
Aug 30, 2003
Messages
36,125
Your reference needs to be a control on the report, or a field in the underlying record source.
 

Micron

AWF VIP
Local time
Today, 07:09
Joined
Oct 20, 2018
Messages
3,478
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")
 

Ksabai

Registered User.
Local time
Today, 04:09
Joined
Jul 31, 2017
Messages
104
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
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:09
Joined
Aug 30, 2003
Messages
36,125
I'd test with IsDate() to make sure it's a date.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 07:09
Joined
May 21, 2018
Messages
8,529
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.
 

Ksabai

Registered User.
Local time
Today, 04:09
Joined
Jul 31, 2017
Messages
104
isDate() is working fine. Now there are no errors.
 

Users who are viewing this thread

Top Bottom