simultaneous MS Access Database access problem using VB6 program.

Reply

Join Date: Oct 2007
Posts: 24
Reputation: dilip_singh3 is an unknown quantity at this point 
Solved Threads: 0
dilip_singh3 dilip_singh3 is offline Offline
Newbie Poster

simultaneous MS Access Database access problem using VB6 program.

 
0
  #1
Oct 13th, 2007
I am using MS Access database by a vb6 program for multiuser environment.
In the program I have written code for autogenerating employee_id which is primary key in the table.
When entering records simultaneously from two or more workstation,
It gives a problem

Run time error
The changes you requested to the table were not successful because they would create duplicate values in the primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.

How to resolve it.
Is there any way to restrict the database from accessing when record appending goes on by other workstation.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 24
Reputation: dilip_singh3 is an unknown quantity at this point 
Solved Threads: 0
dilip_singh3 dilip_singh3 is offline Offline
Newbie Poster

Re: simultaneous MS Access Database access problem using VB6 program.

 
0
  #2
Oct 13th, 2007
using the bold lines below in the code we can handle simultaneous access

Private Sub Command1_Click()
CNN.BeginTrans
If Not VALIDATE() Then Exit Sub
Call GENERATE_EMP_ID
CNN.Execute "INSERT INTO EM VALUES ('" + ID + "', '" + txt_code.Text + "', '" + txt_name.Text + "', " & Val(txt_basic.Text) & ")"
Call SET_DATA_TO_GRID
CNN.CommitTrans
MsgBox "EMPLOYEE ID IS : " + UCase(ID)
CLEAR_CONTROLS
End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC