Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting error '2427' - expression has no value

Status
Not open for further replies.

piperent

Programmer
Feb 7, 2002
156
US
Ok, I have the below code in a simple report and continue to receive this error message when I try to run it. The field it is referring to -'WAIVE_PFEES'- is a logical record field, thus I would assume it to have a resulting value of 'true' or 'false' no matter what.
Text113 is a text object defined as 'currency' and ProcessFee1 is a record field also defined as 'currency'.



Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.WAIVE_PFEES = True Then
Me.Text113 = 0
Else: Me.Text113 = Me.ProcessFee1
End If
If IsNull(Me.TI_AMOUNT) Then
Me.Text127 = 0
Else: Me.Text127 = Me.TI_AMOUNT
End If

End Sub

This all worked fine until I added a new field to this inputs record. Now all I get is this silly error.
What am I missing or doing wrong?

JP
piperent

 
Hi there!
Try this:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
   
    If Me.WAIVE_PFEES[!].Value[/!] = True Then
       Me.Text113 = 0
    Else: Me.Text113[!].Value[/!] = Me.ProcessFee1[!].Value[/!]
    End If
    If IsNull(Me.TI_AMOUNT[!].Value[/!])[!] = True[/!] Then
       Me.Text127[!].Value[/!] = 0
    Else: Me.Text127[!].Value[/!] = Me.TI_AMOUNT[!].Value[/!]
    End If
    
End Sub


Born once die twice; born twice die once.
 
Is WAIVE_PFEES null? Do you set it as 0 as a default? If it's null, I think you'd get that error message. It should have either a 0 or 1 in it in the table.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
I considered both suggestions, and decided to incorporate everything into my logic. This is the resultant code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.WAIVE_PFEES) Then
Me.WAIVE_PFEES = 0
End If
If Me.WAIVE_PFEES.Value = False Then
Me.Text113.Value = Me.ProcessFee1.Value
Else: Me.Text113.Value = 0
End If
If IsNull(Me.TI_AMOUNT.Value) Then
Me.Text127.Value = 0
Else: Me.Text127.Value = Me.TI_AMOUNT.Value
End If

End Sub

I'm still receiving the error message. Strange thing is, the error debugger high-lites the line

'If Me.WAIVE_PFEES.Value = False Then'

as being the offending code. I would have expected the error to occur on the first test of the variable, not the second.

Any other ideas? I'm game for anything.

Thanks for your response.

JP
 
Hi there! Aren't data type issues fun? [smile]

Check your table design. If WAIVE_PFEES data type is Yes/No, then the allowable formats include:
Yes/No
True/False
On/Off

As I am sure you realize, Yes, True and On are equivalent, as are No, False, and Off. However, I have experienced some instances where Access is expecting Yes and when it is passed True, the procedure can bomb out.

Similarly, in VBA, -1 = True while 1 = On (I believe). In both cases, False = 0.

To find out what value is being passed by WAIVE_PFEES, add the lines in red to your code:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
     [!]Msgbox "The value of WAIVE_PFEES is " & Me.WAIVE_PFEES.Value
     Stop[/!]
    If IsNull(Me.WAIVE_PFEES) Then

This should give you what the value is. If it is in fact a null, the message box will read:

The value of WAIVE_PFEES is


There won't be anything else.

Hope this helps.

Tom


Born once die twice; born twice die once.
 
Well, I tried the latest suggestion and 'what to my surprise should appear', just the same old error message - no solution here.

It acts like it doesn't have the data record in place when it goes to print the report.

This is beginning to get frustrating. What a cock-eyed development platform; if you can't do simple things in a simple manner, what good is it?

JP
 
Hi there. I need to know:
1. When you added this statement to your code:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
     [!]Msgbox "The value of WAIVE_PFEES is " & Me.WAIVE_PFEES.Value
     Stop[/!]

Did the message box appear? If it did not appear and then halt your procedure with the [!]Stop[/!] highlighted, then the procedure is not being called due to an error elsewhere. Are you running any code prior to the Detail_Format event? If so, it could be that procedure which is bombing.

Also, you will want to fix this line:
Code:
If IsNull(Me.TI_AMOUNT.Value)[!] = True[!] Then

Again, if you do not receive a msgbox right away which says "The value of WAIVE_PFEES is" then the event is never firing. Following your response, I will show you an error trapping procedure you will want to implement. In the meantime, I need to go to bed.

Until tomorrow,

Tom



Born once die twice; born twice die once.
 
I'm tired and didn't close my TGML tags. The ammended code should be:
Code:
If IsNull(Me.TI_AMOUNT.Value)[!] = True[/!] Then

[blush]

Tom


Born once die twice; born twice die once.
 
Code:
If IsNull(Me.TI_AMOUNT.Value)[!] = True[/!] Then
[blush]

Tom


Born once die twice; born twice die once.
 
Thanks for the response Tom. To answer your question, NO, the message box is never being displayed to begin with, so whatever is happening, happens before the Detail_Format is constructed. That's why I think the record is not even in the buffer at execution time.

If I backup one revision to a preceding version, this works just fine; so, maybe I'll just go back, start all over again, and move forward from that point. It'll probably be faster than wanking around with the current stuff trying to debug code with minimal tools and elusive concepts.

I appreciate everything and if I manage to hammer out a possible reason for my current dilemma, I'll post back and let you know.

Thanks,
JP (piperent)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top