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

Howto update two table at the same time

Status
Not open for further replies.

goobil

Technical User
Aug 9, 2003
38
AG
Hi all,
Can some one please HELP I’m using an upbound form to update two table but I am getting this error.
If I comment out the SET EMPLOYEERS line it will save the data to bank_info table.

The table employee_info is already opened exclusively by another user, or it is already open through the user interface and cannot be manipulated programmatically.

Here is the code
Private Sub Cmdsave_Click()
On Error GoTo Err_Cmdsave_Click

Dim employeeDB As Database
Dim bankDB As Database
Dim bankRs As DAO.Recordset
Dim employeeRS As DAO.Recordset

Set bankRs = CurrentDb.OpenRecordset("bank_info")
Set employeeRS = CurrentDb.OpenRecordset("employee_info")


With bankRs
.AddNew
![accountId] = Me.accID
![Client_name] = Me.clientname
![bank_name] = Me.bankname
.update
End With
bankRs.Close

With employeeRS
.AddNew
![Fname] = Me.Fname
![Lname] = Me.Lname
![hrate] = Me.payrate
![employeetype] = Me.employeetype

.update
End With
employeeRS.Close


Kenneth
kennethg@act2000.net
 
Hi Leigh Moore

No i get the same error message
 
You declare BankDB and EmployeeDB as Database, i don't know DAO at all, but are they 2 separate .mdb files?

if so, you reference both as currentDB but surely only 1 can be the currentDB.

If this is the problem, you need to establish a connection to the other DB in order to access/modify it's data.



Leigh Moore
LJM Analysis Ltd
 
Hi let me explain some more,
I'm using one database.mdb but what i am trying is to update two tables at the same time


 
if your employee table is opened exclusively then you will not be able to update a record in it. check to see if the user interface for the employee table is set for No Locks, Edited Record, or All Records. If it is set to all Records then all records in that table are locked you will not be able to update anything. Hope this helps some.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top