Error 2465 application defined or object defined error.

pn4108

New member
Local time
Today, 08:00
Joined
Nov 17, 2006
Messages
3
hi,
I am new to this forum and to MS Acess. i am not a software engineer or in the field of software. I had to learn as much as i could about MS Acess because of a project i worked on. I have a standalone MSacess database and one of the forms is giving me trouble when I try to enter a new record

The form is called frm_fragrances and has information about a fragrance.
the frm_fragrances has 4 fields in it and a sub form. the sub form has details about the fragrance

In a new record when I enter the 4 fields and attemt to go to the subform which has details about this fragrance I face this error.

an unexpected error haas occurred @2465: application defined or object defined error.

additional information
Active form:<frm_fragrances>
Active control:<txt_VendorName>
Previous control:<frm_fragrances>@Please call the developer for further instructions




I have looked in the FAQ and on this forum for help on error 2465 and cannot find anything to help me. I can work with forms to an extent but cannot write too much code.

I would really appreciate some help in this matter
Thank you
 
Can you post your code, I had this error code the other day. It was with field name definitions. lightray
 
code below

Option Compare Database
Option Explicit

Private Sub Form_DblClick(Cancel As Integer)

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_Form_DblClick

Dim FormName As String
Dim SyncCriteria As String
Dim varArgs As Variant

' If the hidden FragranceCounter on the subform
' is blank, then exit this Sub.
If IsNull(Me![txt_FragranceCounter]) Then
GoTo Exit_Form_DblClick
End If

' Set the formname to the form that will be
' synchronized.
FormName = "frm_PRMs"

' Establish an Open Argument named PRM and place
' into it the hidden PRM Counter. This will be
' retrieved by the called form and will set the open
' record to the correct Fragrance Counter field.
varArgs = adhPutItem(varArgs, "PRM", fld_PRMCounter)

' Check to see if the PRM form
' is open. If it is not open, then open it.
If Not SysCmd(acSysCmdGetObjectState, acForm, FormName) Then
Call glrChainForm(Forms![frm_Fragrances], FormName, , , , varArgs)
End If

Exit_Form_DblClick:
Exit Sub

Err_Form_DblClick:
MsgBox Err.Description
Resume Exit_Form_DblClick

End Sub

Private Sub Form_Error(DataErr As Integer, Response As Integer)

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_Form_Error:

' This calls a general error-handling routine
sfeFormErrorHandler DataErr, Response, Me

Exit_Form_Error:
Exit Sub

Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

' Traps the up and down arrows to move around vertically
' kind of like a spreadsheet. Also traps the tab, shift-tab,
' and return keys.

On Error GoTo Form_KeyDown_Err

Dim recordnum As Long
Dim intShiftDown As Boolean
Dim ctlCurrent As Control

' Set an error constant to handle error that pops up
' regarding the current control when trying to delete
' a record
Const mkNotActiveWindow = 2474

' Find out where the current record is, set a
' shift variable, and set the current control
recordnum = Me.CurrentRecord
intShiftDown = (Shift And SHIFT_MASK) > 0
Set ctlCurrent = Screen.ActiveControl

Select Case KeyCode
Case vbKeyDown
DoCmd.GoToRecord record:=acNext
KeyCode = 0
Case vbKeyUp
DoCmd.GoToRecord record:=acPrevious
KeyCode = 0
Case vbKeyTab
If recordnum = 1 Then ' Check if we're on first record
If intShiftDown Then ' Check if Shift Key is pressed
' Finally, see if we are on the the first field
If ctlCurrent.Name = "cmb_PRM" Then
Me.Parent!txt_VendorName.SetFocus
KeyCode = 0
End If
End If
End If
If NewRecordMark(Me) Then ' Check if we're on a new record
If intShiftDown Then ' Check if Shift Key is pressed
' Do nothing
Else
' See if we are on the the last field and that it is blank
If Not Me.Dirty Then
If ctlCurrent.Name = "txt_MaxPercentPRM" Then
Me.Parent!txt_FragranceNumber.SetFocus
KeyCode = 0
Else
' Do nothing
End If
End If
End If
End If
Case vbKeyReturn
If NewRecordMark(Me) Then ' Check if we're on a new record
If ctlCurrent.Name = "txt_MaxPercentPRM" Then
Me.Parent!txt_FragranceNumber.SetFocus
KeyCode = 0
Else
' Do nothing
End If
End If
Case Else
' Do nothing at all
End Select

Form_Keydown_Exit:
Exit Sub

Form_KeyDown_Err:
Select Case Err.Number
Case mkErrInvalidRow
KeyCode = 0
Case Else
MsgBox "Error: " & Err.Description & _
" (" & Err.Number & ")"
End Select
Resume Form_Keydown_Exit

End Sub

Private Sub txt_MaxPercentPRM_AfterUpdate()

On Error GoTo Err_fld_MaxPercentPRM_AfterUpdate

If Not IsNull([fld_MaxPercentPRM]) Then
If IsNull(txt_Added) Then
txt_WhoAdd = Format(mkGetUser(), "<")
txt_Added = Now()
Else
If Not NewRecordMark(Me) Then ' Check if we're on a new record
Forms![frm_Fragrances]![txt_WhoEdit] = Format(mkGetUser(), "<")
Forms![frm_Fragrances]![txt_Edited] = Now()
End If
End If
End If

Exit_fld_MaxPercentPRM_AfterUpdate:
Exit Sub

Err_fld_MaxPercentPRM_AfterUpdate:
MsgBox Err.Description
Resume Exit_fld_MaxPercentPRM_AfterUpdate

End Sub

Private Sub txt_MinPercentPRM_AfterUpdate()

On Error GoTo Err_fld_MinPercentPRM_AfterUpdate

If Not IsNull([fld_MaxPercentPRM]) Then
If IsNull(txt_Added) Then
txt_WhoAdd = Format(mkGetUser(), "<")
txt_Added = Now()
Else
If Not NewRecordMark(Me) Then ' Check if we're on a new record
Forms![frm_Fragrances]![txt_WhoEdit] = Format(mkGetUser(), "<")
Forms![frm_Fragrances]![txt_Edited] = Now()
End If
End If
End If

Exit_fld_MinPercentPRM_AfterUpdate:
Exit Sub

Err_fld_MinPercentPRM_AfterUpdate:
MsgBox Err.Description
Resume Exit_fld_MinPercentPRM_AfterUpdate

End Sub

Private Sub cmb_PRM_AfterUpdate()

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_cmb_PRM_AfterUpdate

If Not IsNull([cmb_PRM]) Then
If IsNull(txt_Added) Then
txt_WhoAdd = Format(mkGetUser(), "<")
txt_Added = Now()
Else
If Not NewRecordMark(Me) Then ' Check if we're on a new record
Forms![frm_Fragrances]![txt_WhoEdit] = Format(mkGetUser(), "<")
Forms![frm_Fragrances]![txt_Edited] = Now()
End If
End If
End If

Exit_cmb_PRM_AfterUpdate:
Exit Sub

Err_cmb_PRM_AfterUpdate:
MsgBox Err.Description
Resume Exit_cmb_PRM_AfterUpdate

End Sub

Private Sub cmb_PRM_Click()

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_cmb_PRM_Click

If IsNull(fld_PRM) Then
With Me![cmb_PRM]
.SelStart = 0
.SelLength = 0
.Requery
End With
End If

Exit_cmb_PRM_Click:
Exit Sub

Err_cmb_PRM_Click:
MsgBox Err.Description
Resume Exit_cmb_PRM_Click

End Sub

Private Sub cmb_PRM_GotFocus()

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_cmb_PRM_GotFocus

If IsNull(fld_PRM) Then
With Me![cmb_PRM]
.SelStart = 0
.SelLength = 0
.Requery
MsgBox "Howdy"
End With
End If

Exit_cmb_PRM_GotFocus:
Exit Sub

Err_cmb_PRM_GotFocus:
MsgBox Err.Description
Resume Exit_cmb_PRM_GotFocus

End Sub

Private Sub cmb_PRM_NotInList(NewData As String, Response As Integer)

'======================================================
'
' By Michael R. McCullough
' Global Research and Development
' Extension 6454
'
' (c) 2000 by Mary Kay Holding Corp.
' All rights reserved.
'
'=======================================================

On Error GoTo Err_cmb_PRM_GotFocus

If Not IsNull(DLookup("fld_PRM", "qry_PRMComboList", _
"fld_PRM=""" & NewData & """")) Then
Response = acDataErrAdded
Exit Sub
End If

If MsgBox("""" & NewData & """ is not in the PRM list. " & _
"Do you wish to add it?", 33) <> 1 Then
Response = acDataErrContinue
Exit Sub
End If

Call glrChainForm(Forms![frm_Fragrances], "frm_PRMsAdd", , , acFormAdd)

With Forms!frm_PRMsAdd
.txt_PRM.SetFocus
.txt_PRM = NewData
End With

Response = acDataErrContinue

Exit_cmb_PRM_GotFocus:
Exit Sub

Err_cmb_PRM_GotFocus:
MsgBox Err.Description
Resume Exit_cmb_PRM_GotFocus

End Sub
 
Hi Pn4108, I was hoping to just get the code around where the error occured.

where you pressing a command button at the time it happened?
when did the error occur?
 
Hi PN - did you develop all this code? its just that you say you are not used to access, but it looks really complex.

Anyway,
This error message looks like a custom message, not a standard Access message

- now near the top of your code, in the error handler, you have a line

sfeFormErrorHandler DataErr, Response, Me

this looks to me like this is the error handler that is taking an error in your form, and formatting it in the way you are seeing it.

-------------------------------------
its hard to see at a glance, but is the form-dblclick the event you use to get to the subform? - if so , i would put a break point in the code at the top of that sub, and trace the execution from there, to see if you can see what's causing the error
 

Users who are viewing this thread

Back
Top Bottom