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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 2427

Status
Not open for further replies.

ozzroo

Technical User
Feb 28, 2003
182
AU
Hi all

I keep getting runtime error 2427. This form has been working fine up until today. it just started with the error.

Basically depending on how much a client has invested it will show different images like Gold, Silver & Bronze. The problem only happens on clients who havent invested anything

Any help please

Thanks

Dim ctl As Control

Set ctl = Me!OverallTotal

If ctl >= 0 And ctl <= 3000 Then
Me!silver.Visible = False
Me!gold.Visible = False
Me.bronze.Visible = True
Me.ClientType = "3"

ElseIf ctl >= 3001 And ctl <= 10000 Then
Me!bronze.Visible = False
Me!gold.Visible = False
Me!silver.Visible = True
Me.ClientType = "2"
ElseIf ctl > 10001 Then
Me.bronze.Visible = False
Me.silver.Visible = False
Me!gold.Visible = True
Me.ClientType = "1"
Else
Me.bronze.Visible = False
Me.silver.Visible = False
Me!gold.Visible = False
Me!ClientType = Null
End If
 
Hey Oz,

Is runtime error 2427 "has no value" error? It would help out if we knew what the errors says but I'll take a shot in the dark. Maybe you should nest your code inside of another If statement that checks for Me!OverallTotal being either empty or Null and stop the code or have it do the last Else in your existing code, if it is empty or Null.

HTH,
Shane
 
Yeah the error is the "has no value" error
 
Or just make sure that ctl isn't null.
Code:
Set ctl = nz(Me!OverallTotal, 0)
will set a null value to zero.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Would a zero-length string work?
Code:
   Dim ctl As Control
   
   Set ctl = Me!OverallTotal
   Me!silver.Visible = False
   Me!gold.Visible = False
   Me.bronze.Visible = False

   If ctl >= 0 And ctl <= 3000 Then
       Me.bronze.Visible = True
       Me.ClientType = "3"
      
   ElseIf ctl >= 3001 And ctl <= 10000 Then
      Me!silver.Visible = True
      Me.ClientType = "2"

   ElseIf ctl >= 10001 Then
      Me!gold.Visible = True
      Me.ClientType = "1"

   Else
      Me!ClientType = ""

   End If
 
The simple thing would be to assign an image for clients who haven't invested, like an image of a tight fist, say! Seriously, assign an image for this eventuality.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks for the info people but zero string doesnt work.

The criteria is running on a query from the tblDealingHistory. So those people who havent invested wont have a record in the deal history which comes as a null value.

I backed up the database before this happened and tried copying the working forms across to the broken forms but still no luck.
 
With that being said, then couldn't you do some kind of a recordcount using the individual as a criteria and if it comes up <=0 then have something else happen and not let your code even get started?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top