Error 2427 You entered an expression that has no value

M

M Skabialka

A module in form frmPRONGeneration looks at values on the subform like this:

Dim ps As Form
Set ps = Forms!frmPRONGeneration![frmPRONGeneration subform].Form
Select Case ps!LastSerialNumber 'Error 2427 You entered an
expression that has no value
etc

LastSerialNumber is a field on the subform

Why am I getting the error 2427?
I don't understand in what way it has no value.

Thanks,
Mich
 
A

Allen Browne

Couple of example:

What kind of control is LastSerialNumber?
It would have no value if it were a label, for example.

If the subform had no records and no new records could be added, the subform
goes completely blank. Attempting to refer to the value of the non-existent
control then generates an error.
 
M

M Skabialka

I am having the user select from 3 combos, each one refines the information
for the subform, and the last choice selects the only record for the
sub-form.

The code runs on the update of the last combo. Then I look at some of the
data and make some updates to the info on the sub-form.

If I reselect the last combo while the sub-form is still populated I don't
get the error message.

Should I be using something else other than the After Update to run the
subsequent info update code?

Thanks,
Mich

Allen Browne said:
Couple of example:

What kind of control is LastSerialNumber?
It would have no value if it were a label, for example.

If the subform had no records and no new records could be added, the subform
goes completely blank. Attempting to refer to the value of the non-existent
control then generates an error.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

M Skabialka said:
A module in form frmPRONGeneration looks at values on the subform like this:

Dim ps As Form
Set ps = Forms!frmPRONGeneration![frmPRONGeneration subform].Form
Select Case ps!LastSerialNumber 'Error 2427 You entered an
expression that has no value
etc

LastSerialNumber is a field on the subform

Why am I getting the error 2427?
I don't understand in what way it has no value.

Thanks,
Mich
 
A

Allen Browne

If ps.RecordsetClone.RecordCount = 0 Then
MsgBox "Cannot read value (unless records can be added)"
Else
'do your stuff

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

M Skabialka said:
I am having the user select from 3 combos, each one refines the information
for the subform, and the last choice selects the only record for the
sub-form.

The code runs on the update of the last combo. Then I look at some of the
data and make some updates to the info on the sub-form.

If I reselect the last combo while the sub-form is still populated I don't
get the error message.

Should I be using something else other than the After Update to run the
subsequent info update code?

Thanks,
Mich

Allen Browne said:
Couple of example:

What kind of control is LastSerialNumber?
It would have no value if it were a label, for example.

If the subform had no records and no new records could be added, the subform
goes completely blank. Attempting to refer to the value of the non-existent
control then generates an error.


M Skabialka said:
A module in form frmPRONGeneration looks at values on the subform like this:

Dim ps As Form
Set ps = Forms!frmPRONGeneration![frmPRONGeneration subform].Form
Select Case ps!LastSerialNumber 'Error 2427 You entered an
expression that has no value
etc

LastSerialNumber is a field on the subform

Why am I getting the error 2427?
I don't understand in what way it has no value.

Thanks,
Mich
 
M

M Skabialka

Solved it!

I put
ps.Requery
right before
Select Case ps!LastSerialNumber

and now it is working!

There is always a record in the sub-form because the combos are selecting
from values in the same table the sub-form uses.

Thanks for your help!
Mich


Allen Browne said:
If ps.RecordsetClone.RecordCount = 0 Then
MsgBox "Cannot read value (unless records can be added)"
Else
'do your stuff

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

M Skabialka said:
I am having the user select from 3 combos, each one refines the information
for the subform, and the last choice selects the only record for the
sub-form.

The code runs on the update of the last combo. Then I look at some of the
data and make some updates to the info on the sub-form.

If I reselect the last combo while the sub-form is still populated I don't
get the error message.

Should I be using something else other than the After Update to run the
subsequent info update code?

Thanks,
Mich

Allen Browne said:
Couple of example:

What kind of control is LastSerialNumber?
It would have no value if it were a label, for example.

If the subform had no records and no new records could be added, the subform
goes completely blank. Attempting to refer to the value of the non-existent
control then generates an error.


A module in form frmPRONGeneration looks at values on the subform like
this:

Dim ps As Form
Set ps = Forms!frmPRONGeneration![frmPRONGeneration subform].Form
Select Case ps!LastSerialNumber 'Error 2427 You entered an
expression that has no value
etc

LastSerialNumber is a field on the subform

Why am I getting the error 2427?
I don't understand in what way it has no value.

Thanks,
Mich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top