Error 2427 : You entered an expression that has no value. (1 Viewer)

GaP42

Active member
Local time
Today, 19:49
Joined
Apr 27, 2020
Messages
338
I have a Sales Form, which can be opened from a Sales History form without issue. However, as Sales can also include sales of subscriptions, I also have a Subscriptions History form that allows the originating Sale form record to be opened - at least that was the intention. Using an almost identical approach, the above error message occurs with the Form_Current of the Sale Form, only when opening the form from Subscriptions History.

Both History forms pass the value of the OrderID(SaleID) and an OpenArg: one openArg is used to indicate if a new sale record is requested. It is "0" whenever a subscription history record is used to retrieve a Sales record.

The issue occurs with the control: Me.TxStatusID ... the txStatus is an optional FK used to determine if the record is a cancelled transaction (the sales order may be a lapsed quote for eg.), which is then used to set what controls are enabled on the Sale form.

The offending line is : If Me.TxStatusID = 0 Or (IsNull(Me.TxStatusID)) Or Me.TxStatusID = "" Then

When opening the Sale form from Subscription History, after accepting the error message, the form does not display any content.

Any suggestions as to what is the cause and how to work around it?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:49
Joined
Feb 28, 2001
Messages
27,186
Put a breakpoint on that line and launch your app. Exercise it to bring it to the point where it would execute that line. When the break occurs, the line has not yet been executed. At this point, you can hover the cursor over Me.txStatusID to see its value (which might include NULL). You can also use immediate mode and type Debug.Print (Me.TxStatusID=0) ... which should give True or False (or -1 or 0, respectively). Ditto for the other parts of the line.
 

ebs17

Well-known member
Local time
Today, 11:49
Joined
Feb 7, 2020
Messages
1,946
Alongside:
If Me.TxStatusID = 0 Or (IsNull(Me.TxStatusID)) Or Me.TxStatusID = "" Then

This is nonsense. Are you unsure about the data type used?
A look at the table definition should help.
 

GaP42

Active member
Local time
Today, 19:49
Joined
Apr 27, 2020
Messages
338
Thanks @The_Doc_Man - I had used the breakpoint and checked TxStatusID. When opening from the Sales History, me.TxStatusID is 0, however when opened from Subscription History the debug.print results in the same error message - neither true nor false. So it points to a problem prior to this point.
@ebs17 - yeah - the additional ORs in the statement were attempts to try to get past the point - those tests in the if statement were not used prior to the problem. TxStatusID is a FK and is defined as integer.

Thanks - I have resolved the problem - an incorrect reference to the OrderID when opening the form from Subscription History using which uses this value as the filter(where) to display the selected sales record.
 

Users who are viewing this thread

Top Bottom