0

Hello guys!

Can you help me this type of error?

Run-time error '8574':

The object 'Employee ID:' was not found

This is the code:

Private Sub cmdPreview_Click()

Dim rsq As New Recordset

rsq.Open "SELECT * FROM qRecord where EmpID = " & Val(txtEmpID.Text) & "", con, adOpenStatic, adLockReadOnly, addUnknown
    
If rsq.EOF = False Then
    MsgBox "No records to view.", vbInformation, "No Records"
Else

    With drTrans.Sections(2)
        .Controls(Label1.Caption) = rsq.Fields("EmpID")
        .Controls(Label2.Caption) = rsq.Fields("LastName") & "," & rsq.Fields("FirstName")
        .Controls(Label3.Caption) = rsq.Fields("Position")
        
    End With
    
    Set drTrans.DataSource = rsq
    
    drTrans.Show
End If
End Sub

Edited by dwiniers: n/a

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by BitBlt
0

well I can't see anything referring to an object Employee ID but I am thinking you probably need to move line 18 above line 11. not much point in trying to use drTrans until you have assigned it a value.

0

Assuming this is a DataReport, this type of error usually occurs when there is a mismatch between the DataEnvironment that was initially used to create the report, and the RecordSource that is used to populate the report at runtime. You should verify that you're using the right column names.

As a general rule, it's a good idea to explicitly name the columns in your SQL statement rather than use the wildcard '*' to return the columns you need. That way you can verify that the column names you're expecting match what the DataEnvironment originally specified.

Hope that helps! Good luck!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.