N
NightZen
I have created several multi-user FE/BE databases using Access and they work fine. I recently purchased MS Office developer so that I could create a multi-user databse for a set of computers on our shop floor - the thing is they diddn't want to spring for Access liscenses on all of these computors just for this little Preventive Maintenance Database a wrote, so I created a FE and used developer to bundle a run-time instance of Access
It works fine when one user connects. But when a second computor connects and tries to enter certain data (see below), I get an error: "could not update; currently locked." If I connect with two computors and open the database with access (not the run-time instance), I get no such error
The main input form has 4 fields: date, operator, machine, and frequency. After he selects these he press a button to populate a subform with maintenance items using the code below. Each Item has a discription, and a text-box for entering "DONE". When more than one user is connected at a run-time instance, data-entery into the main form is accepted, pressing the button populates the subform correctly, but entries cannot be made into the subform. I'm Stumped! and I could really use some help
Thanks, Keit
Private Sub Command9_Click(
Dim strPMNum As Strin
Dim strPMTaskKey As Strin
Dim strMach As Strin
Dim db As DAO.Databas
Dim TaskList As DAO.Recordse
Dim ToDoList As DAO.Recordse
Dim rstPMSubForm As DAO.Recordse
Dim Response As Varian
Dim intRecord As Intege
On Error GoTo Err_Ou
' Turn Off Warnings for delete and create queries to ru
DoCmd.SetWarnings Fals
' Grab recor
lngRecord = Me.CurrentRecor
' Checks for necissary data to create task lis
If Me.Machine.Value > 0 And Me.Frequency.Value > 0 The
DoCmd.Bee
GoTo Continue
Els
MsgBox "You have not given me enough info! "
& "Enter the Machine type and Frequency.
GoTo ExitNo
End I
Continue1
' Look at subform for records - if they exist allready, warn before deleting and continuin
Set db = CurrentDb(
DoCmd.OpenQuery "qryPMSubTemp_D
DoCmd.OpenQuery "qryPMSubTemp
Set rstPMSubForm = db.OpenRecordset("tblPMSubTemp"
If rstPMSubForm.RecordCount > 0 The
Response = MsgBox("Maintenance tasks have allready been added to this record. Do you wish to overwrite?", vbYesNo + vbCritical + vbDefaultButton2, "Syron PM Databse"
If Response = vbYes The
DoCmd.OpenQuery "qryDeletePMSub
GoTo Continue
End I
If Response = vbNo The
MsgBox "Action Canceled", , "Syron PM Databse
GoTo ExitNo
End I
End I
Continue2
' Setup table using delete and append queries for TaskList Recordse
DoCmd.OpenQuery "qryTasks_D
DoCmd.OpenQuery "qryTasks
' Set up the database and query connection
Set TaskList = db.OpenRecordset("tblNewTasks"
Set ToDoList = db.OpenRecordset("tblPMSub"
strPMNum = Forms!frmPM!PMNumbe
strMach = Forms!frmPM!Machin
' Loop thru task list and add tasks to tblPMSub via ToDoList recordse
Do Until TaskList.EO
strPMTaskKey = TaskList("TaskKey"
ToDoList.AddNe
ToDoList!PMNumber = strPMNu
ToDoList!TaskKey = strPMTaskKe
ToDoList.Updat
TaskList.MoveNex
Loo
' Refresh Subfor
Me.Requer
DoCmd.GoToRecord acDataForm, "frmPM", acGoTo, lngRecor
' Cleanup Recordset
Set TaskList = Nothin
Set ToDoList = Nothin
Set rstPMSubForm = Nothin
' Turn on Warnings agai
DoCmd.SetWarnings Tru
Err_Exit
Exit Su
Err_Out
MsgBox Err.Descriptio
Resume Err_Exi
ExitNow
Exit Su
End Su
It works fine when one user connects. But when a second computor connects and tries to enter certain data (see below), I get an error: "could not update; currently locked." If I connect with two computors and open the database with access (not the run-time instance), I get no such error
The main input form has 4 fields: date, operator, machine, and frequency. After he selects these he press a button to populate a subform with maintenance items using the code below. Each Item has a discription, and a text-box for entering "DONE". When more than one user is connected at a run-time instance, data-entery into the main form is accepted, pressing the button populates the subform correctly, but entries cannot be made into the subform. I'm Stumped! and I could really use some help
Thanks, Keit
Private Sub Command9_Click(
Dim strPMNum As Strin
Dim strPMTaskKey As Strin
Dim strMach As Strin
Dim db As DAO.Databas
Dim TaskList As DAO.Recordse
Dim ToDoList As DAO.Recordse
Dim rstPMSubForm As DAO.Recordse
Dim Response As Varian
Dim intRecord As Intege
On Error GoTo Err_Ou
' Turn Off Warnings for delete and create queries to ru
DoCmd.SetWarnings Fals
' Grab recor
lngRecord = Me.CurrentRecor
' Checks for necissary data to create task lis
If Me.Machine.Value > 0 And Me.Frequency.Value > 0 The
DoCmd.Bee
GoTo Continue
Els
MsgBox "You have not given me enough info! "
& "Enter the Machine type and Frequency.
GoTo ExitNo
End I
Continue1
' Look at subform for records - if they exist allready, warn before deleting and continuin
Set db = CurrentDb(
DoCmd.OpenQuery "qryPMSubTemp_D
DoCmd.OpenQuery "qryPMSubTemp
Set rstPMSubForm = db.OpenRecordset("tblPMSubTemp"
If rstPMSubForm.RecordCount > 0 The
Response = MsgBox("Maintenance tasks have allready been added to this record. Do you wish to overwrite?", vbYesNo + vbCritical + vbDefaultButton2, "Syron PM Databse"
If Response = vbYes The
DoCmd.OpenQuery "qryDeletePMSub
GoTo Continue
End I
If Response = vbNo The
MsgBox "Action Canceled", , "Syron PM Databse
GoTo ExitNo
End I
End I
Continue2
' Setup table using delete and append queries for TaskList Recordse
DoCmd.OpenQuery "qryTasks_D
DoCmd.OpenQuery "qryTasks
' Set up the database and query connection
Set TaskList = db.OpenRecordset("tblNewTasks"
Set ToDoList = db.OpenRecordset("tblPMSub"
strPMNum = Forms!frmPM!PMNumbe
strMach = Forms!frmPM!Machin
' Loop thru task list and add tasks to tblPMSub via ToDoList recordse
Do Until TaskList.EO
strPMTaskKey = TaskList("TaskKey"
ToDoList.AddNe
ToDoList!PMNumber = strPMNu
ToDoList!TaskKey = strPMTaskKe
ToDoList.Updat
TaskList.MoveNex
Loo
' Refresh Subfor
Me.Requer
DoCmd.GoToRecord acDataForm, "frmPM", acGoTo, lngRecor
' Cleanup Recordset
Set TaskList = Nothin
Set ToDoList = Nothin
Set rstPMSubForm = Nothin
' Turn on Warnings agai
DoCmd.SetWarnings Tru
Err_Exit
Exit Su
Err_Out
MsgBox Err.Descriptio
Resume Err_Exi
ExitNow
Exit Su
End Su