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!

Subform Run-Time error '2427'...You entered an expression that has no

Status
Not open for further replies.

fridge74

Technical User
May 28, 2003
10
US
I was wondering if anyone might have a way of work around for what I am trying to do.

I have a subform based on a query that looks to see if a product is good. If it it good it is marked by a time stamp. After the time expires the code marks the product is no longer good, marks taht it needs to be resampled and the DateTime it needs resampled.

The code has been working great until one little snag. When there is no longer any sample to run the code against I get the '2427' Runtime error. You entered an expression that has no value.

This makes sense but I have been unable to figure out how to see if the field is there to run the code against. I have banged my head on this for a couple weeks now and woudl love some help or suggestions if anyone has any.

I will post the code I am using.

Thanks in advance.

Private Sub Form_Timer()
Me.Text46 = Now
Me.Form.Requery



If Me.txtMinsGood.Value >= 10080 Then
Me.dtmDateNeedsResampled = Now
Me.ysnNeedsResampled = True
Me.ysnOKtoUnload = False

End If

End Sub

I basically just run the code once a minute.
 
I am not exactly sure of what you want. When you say "When there is no longer any sample to run the code against" do you mean that the query has not returned any records? If so, you can check the record count of the subform recordset.

 
When I say "there is no longer any sample to run the code against", yes, the query does not return any records.

As far as checking the record count of the subform, I have never done anything like that before.
 
It seems you are running the code on the subform, so it may be quite easy:

Code:
If Me.Recordset.RecordCount=0 Then
     'Do something
End If

If you are running the code on the main form, you need a little more:

Code:
If Me.[NameOfSubFormControl].Form.Recordset.RecordCount=0 Then
<...>

 
Thank you...

Made it run the if statement if the record count>0

Has been running now every 10 seconds with no problems.

Again thanks was one hurdle I had to get over.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top