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

Runtime error 2486

Status
Not open for further replies.

parkem

Technical User
May 1, 2001
3
Runtime error 2486...Can't carry out this action at present time.

I have a problem that just started. My input form accesses two main tables: companies and company employees. The main form allows the user to select the company and display the company employees in a subform. To edit info on an employee the user dbl clicks on the employee name in the subform to display the employee edit form then make corrections and click a Save button that saves the new info and returns to the main form. This works fine the first time through (and until recently every time). However, whenever the second employee is selected (by dbl click) I get the above error message and the database locks up.

I have gone through the code and cannot find the problem. It all works fine when I step through the code.

I would greatly appreciate any help on this.

Thomas
 
ToeShot, the code is as follows...it is long
The following is in the form "On Open Event". It simply sets up the form depending on how it will be used. I am not having any problems with adding to new or existing companies, only editing employees:

Private Sub Form_Open(pintCancel As Integer)
Call OpeningRoutine
End Sub

Private Sub OpeningRoutine()
'dim variables
Dim strFacilityNumber As String
Dim strNewAcctNo As String
Dim ctl As Control

'get facility number
strFacilityNumber = Forms!frmMoAcctCustEntry!cboFacilityNumber
'get HT or Key information;disable key field if HT
Set rst = New ADODB.Recordset
Set rst.ActiveConnection = CurrentProject.Connection

rst.Open "SELECT * FROM tblFacilityNumbers WHERE FacilityNumber = '" & strFacilityNumber & "'"
If rst!HangTagFlg Then txtCardNum.Enabled = False
rst.Close
Set rst = Nothing

Select Case Forms!frmMoAcctCustEntry!AddEditMode
Case Is = "AddNew"
'Code for adding to new accounts here
Case Is = "Add"
'Code for adding to existing accounts here
Case Is = "Edit"
Dim objPrkr As clsParker
Dim strKey As String

'set movement/entry controls
optInactive.Enabled = True
optHold.Enabled = True
cmdCloseFrm.Enabled = False
cmdPrkrUndo.Enabled = False
txtStartDate.Enabled = False
txtEndDate.Enabled = False
fraApplyDisc.Enabled = False
fraProRateFlg.Enabled = False

'set Facility number
Me!FacilityNumber.Value = strFacilityNumber

'Get the record for the selected employee
strKey = Forms!frmMoAcctCustEntry!subPrkrInfo!CardNum
If strKey <> &quot;&quot; Then
Set objPrkr = New clsParker
objPrkr.txtCardNum = Forms!frmMoAcctCustEntry!subPrkrInfo!CardNum
Else
Set objPrkr = New clsParker
objPrkr.txtPrkrNumber = Forms!frmMoAcctCustEntry!subPrkrInfo!txtPrkrNum
End If
If objPrkr.Load() Then
Call ScatterFields(objPrkr)

Set rst = New ADODB.Recordset
Set rst.ActiveConnection = CurrentProject.Connection
rst.Open &quot;SELECT * FROM tblMoRateCodes WHERE FacilityNumber = '&quot; & strFacilityNumber & &quot;'&quot; & _
&quot;AND RateCode = '&quot; & txtCode & &quot;'&quot;
txtRate.Value = rst!PublishedAmt
rst.Close
Set rst = Nothing
End If
'set the prorate field
ProrateMoYr.Value = Date
Case Else
Call MsgBox( &quot; & vbCrLf & &quot;Please select an Customer. &quot;, _
vbOKOnly + vbInformation + vbDefaultButton1)
End Select
End Sub

The following is the code associated with the &quot;Save&quot; button after a change has been made on the customer form:

Private Sub cmdPrkrSave_Click()

cmdCloseFrm.Enabled = True

'Get info from form on which button was clicked
strMode = Forms!frmMoAcctCustEntry!AddEditMode

'Check if there is a name in the Employee field
If Me!txtPrkrLName = &quot;&quot; Then
MsgBox &quot;Employee Name Required&quot;, vbExclamation
txtPrkrLName.SetFocus
Exit Sub
End If
'Check if type is selected
If IsNull(Me!cboType) Then
MsgBox &quot;Type Required&quot;, vbExclamation
cboType.SetFocus
Exit Sub
End If
'Check for a key card number
If txtCardNum.Enabled = True Then
If fraPrkrStatus = 1 Then
If Me!txtCardNum = &quot;&quot; Then
MsgBox &quot;Card Number Required&quot;, vbExclamation
txtCardNum.SetFocus
Exit Sub
End If
End If
End If

'Save the employee information
Call GatherFields(pObjPrkr)
Call pObjPrkr.Save
Forms!frmMoAcctCustEntry!TabCtl20.Pages![employee Information].Requery

'get/set facility number
strFacilityNumber = Forms!frmMoAcctCustEntry!cboFacilityNumber

Select Case strMode
Case Is = &quot;AddNew&quot;
'ADD employee during company input
Call AddNew
Case Is = &quot;Add&quot;
'ADD employee to existing company
Call Add
Case Is = &quot;Edit&quot;
'EDIT EXISTING employee
'Only Write prorate info to tblMoAdjDetails if there is a change in status
If fraProRateFlg = 1 Then
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.Open &quot;SELECT * FROM tblMoAdjDetails &quot; & _
&quot;WHERE FacilityNumber = '&quot; & strFacilityNumber & &quot;'&quot;, , adOpenKeyset, adLockOptimistic
With rst
.AddNew
!FacilityNumber = strFacilityNumber
!CoAcctNum = CustAcctNum
!PrkrNum = txtPrkrNumber
!PrkrName = txtPrkrLName
!PrkrCard = txtCardNum
!ManEmployeeName = Forms!frmMoAcctCustEntry!AcctName
!PrkrAdjExplanation = &quot;1&quot; 'Cancel employee
!PrkrAdjDate = txtStartDate
!Amt = txtProrateAmt
!SlsTaxAmt = pObjPrkr.ComputeSlsTax(txtProrateAmt, strFacilityNumber)
!PrkgTaxAmt = pObjPrkr.ComputePrkgTax(txtProrateAmt, strFacilityNumber)
If Forms!frmMoAcctCustEntry!IndvFlag Then
!WhenFlg = 1 'now
Else
Dim lngRetval As Long
lngRetval = MsgBox( &quot;Would you like to invoice this Company Account now?&quot;, _
vbYesNo + vbInformation + vbDefaultButton1)
Select Case lngRetval
Case vbYes
!WhenFlg = 1 'now
Case vbNo
!WhenFlg = 2 ' next per
End Select
End If
!InvcdFlg = False
.Update
End With
rst.Close
Set rst = Nothing
End If

DoCmd.Close acForm, &quot;frmMoPrkrInput&quot;
End Select
End Sub
 
Maybe it's not the code, but the operating system?

A few years ago we had Access97 loaded on Windows 95 machines. The complex database with lots of linked tables ran well. Then one day I got a new workstation with Windows 98 on it. I made a few changes to codes and fields and Windows 95 users received dozens of &quot;run-time&quot; errors when they ran specific events.

We purchased licenses and installed Windows 98 on them.
No problems since.

Erie huh? Happy Halloween.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top