Hi,
I am trying to insert data from one table (Emp_Details) into another table (Requests) based on the employee ID entered in the access form. I have writen the following code:
But it gives an error 7874 saying that MS Access cant fine the Object.
How can I solve this problem?
Thanks in advance,
MK
I am trying to insert data from one table (Emp_Details) into another table (Requests) based on the employee ID entered in the access form. I have writen the following code:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim sel As String
'Set con = New dao.Connection
'Set rs = New DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Emp_Details", dbOpenDynaset)
Set rs1 = db.OpenRecordset("Requests", dbOpenDynaset)
rs1.AddNew
DoCmd.OpenQuery "Insert into Requests(ID, LName, FName, Manager, Email, Level) Select Emp_Details.ID, Emp_Details.LName, Emp_Details.FName, Emp_Details.EManager, Emp_Details.Email, Emp_Details.L from Emp_Details Where Emp_Details.ID = '" & txtID & "'"
rs1.Update
rs1.Close
db.Close
Set rs1 = Nothing
Set db = Nothing
How can I solve this problem?
Thanks in advance,
MK
Comment