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 unbound 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
 
Which line is the error showing up on?
put a single quote here
' On Error GoTo Err_Cmdsave_Click

and it will stop on the line in question when you run it.

DougP, MCP
 
If you cannot 'get around' the exclusive situyatin, you might consider putting your data in a temp table to be updated by one of the users (or admin) periodically. If would seem better to unbind your forms and lock only the records being used. The unbound forms would grab the record only when reading the data initally and updating the record - milliseconds each. You would have to check for dirty and code in a referee also but that is no big deal. WROX says the unbinding of forms makes an app significantly faster as the number of users go up.

Rollie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top