Hi all... please help me with this code... i hv retrieved the id of the employee from the login n stored it as a lable in my form- logid but now with respect to that i want to get the employee name... please help very urgent!!

Dim rs As adodb.Recordset
Dim getname As String
getname = "SELECT E_name FROM Employee_Details WHERE E_ID ='" & logid.Caption & "'"
rs.Open getname, CN

logname.Caption = rs.Fields(0)

the error msg shown is "object variable or with block variable not set."
please help its very urgent!

There are a few points that could cause error:
- change

Dim rs As adodb.Recordset


Dim rs As New adodb.Recordset

- make sure that CN is not nothing eg. you do have a valid connection object
- your query may return empty recordset. Haven't dealed with these for a long time but check that


is not nothing. I mean that rs is not nothing.


Dim rs As new adodb.Recordset

your problem is solved.

thnakx a lot!... it is solved...!
its working now!
n good day!