| | |
simultaneous MS Access Database access problem using VB6 program.
![]() |
•
•
Join Date: Oct 2007
Posts: 24
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Oct 2007
Posts: 24
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Running a VB application with MS Access database (Visual Basic 4 / 5 / 6)
- How to assure data gets stored in MS Access (Visual Basic 4 / 5 / 6)
- i cant save data on an access database (C#)
- VB6 & Access (user name, network printer, reminders) (Visual Basic 4 / 5 / 6)
- Pls help me regarding to access database in vb6 (Visual Basic 4 / 5 / 6)
- I hava trouble with Microsoft Access database, Pls help me. (Java)
- Insert radio button value into MS Access database (ASP)
- database access is getting slow day by day (MySQL)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Save code to text file?
- Next Thread: VB codes
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





