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

How do I supress/correct a Runtime 2455 error message?

Status
Not open for further replies.

Piff

Technical User
Dec 29, 2001
1
CA
My form eventually does what I would like it to do, but I get a Runtime 2455 error and have to go through the motions of closing the debug window to get my search results.

I have used the Wizard to add a command button to Find Record, and I have also tried with macros. When I enter the criteria, a Runtime 2455 error message appears. When I click on the debug button, it shows the line of script (in **) which was written to determine the status of an employee (have they worked within the last 90 days?):

Code:
Private Sub Form_Current()
   
  *   If Forms!frmEmployeeAll!sbfrmDays.Form!MinOfDays <= 90 Then  *
        Me!status2.ForeColor = 8388608
        Me!status2 = &quot;Active&quot;
        Me!Name.ForeColor = 8388608

    ' Otherwise, Status2 reads Inactive and the Member
    ' is flagged with Red text in the Name field.
    
    Else
        Me!status2.ForeColor = 150
        Me!status2 = &quot;Inactive&quot;
        Me!Name.ForeColor = 150

    End If
     
End Sub

As soon as I close this window, my results appear, but every time I repeat the search, I get the same error.

I will definitely concede that my coding is rather rudimentary, but I just stumbled into VBA by accident.

Thanks,
Stephanie
 
The error is an invalid reference to the property, so first, I would try bracketing the references.
Code:
If Forms![frmEmployeeAll]![sbfrmDays].Form![MinOfDays]

Still, from the description of the error occuring when you try to execute a search, could guess that the OnCurrent event you've written is running before the subform is re-linked/requeried. Try
Code:
  Forms![frmEmployeeAll]![sbfrmDays].Requery

ahead of the If...Then statement.

HTH

John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top