Error 2115 and Listbox

  • Thread starter Thread starter Timothy McLees
  • Start date Start date
T

Timothy McLees

I have searched the internet to find out what I can do to find the
reason of why I am getting this 2115 error. What seems to be happening
is after I set the the rowsource for listbox 1 and then try to set
focus on another control this error fires. What I have read in the
old post about this is that some control seems to be still doing some
kind of update. Just to be clear as in some of the cases I do not
have code in either the before update proc or any validation rule on
any control in my app and all controls and the form are unbound. I
am hoping someone has found the reason this error fires when nothing
is being updated or can give some hint as to what this error has to do
with list boxes and setting focus or doing .selected(0) = True.

Thanks in advance for any help given
 
More information might get this noticed

i have 3 list boxes

each list box is on a seperate page of a tab control

everything is unbound

so when the page loads i set the focus and the row source for the
first control and then set the .selected(0) = true for the first
listbox

which does what I want - it fires the onclick event for the first
listbox

in the click event for the for the first listbox I set the focus and
the rowsource for the second list box and then set the .selected(0) =
true for the second listbox

now what I want to happen is that setting the .selected(0) = true for
the second listbox should fire the onclick event for the second
listbox so I can set information about 3rd listbox

but the nothing happens it just ends the first listboxes onclick event
and returns to the onload event and stops

if I try to do anything to force the click event for second list box I
get the 2115 error.

What I am confused about is what if anything is happening that would
be related to what the error says is happening since I have no updates
going on to any records in this code.

and why does the state that the code must be in stop the second
onclick event from firing?

Thanks
 
now what I want to happen is that setting the .selected(0) = true for
the second listbox should fire the onclick event for the second
listbox so I can set information about 3rd listbox

Setting a property in code will not cause the Click event (or any other event,
such as AfterUpdate) to fire. Only the user clicking the control will do that.

Just explicitly call the procedure for the second control in the appropriate
event of the first control.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Thank John for taking the time to look at my issue.

I just realized I never said that this is an Access 2010 database.

can you explain to me what is happening in my code - when I step thru
it I come to the line in Form_Load **Me.lstPlanes.Selected(0) = True**
and flows right into **Private Sub lstPlanes_Click()** that is why i
thought setting the selected property fired the click event.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Option Compare Database

Private Sub Form_Load()
'***********************************
'*
'*
'***********************************

On Error GoTo Err_FormLoad

Me.lstPlaneNames.RowSource = ""
Me.lstPlanes.RowSource = ""
Me.lstSites.RowSource = ""
Me.lstSubPlaneNames = ""
Me.lstSubPlanes.RowSource = ""

Me.lstPlanes.RowSource = "SELECT DimensionalPlaneNames.PlaneName,
DimensionalPlaneNames.PlaneId FROM DimensionalPlaneNames WHERE
DimensionalPlaneNames.TrueName = True AND
DimensionalPlaneNames.SubPlaneId Is Null ORDER BY
DimensionalPlaneNames.PlaneName;"

Me.lstPlanes.Selected(0) = True


Exit_FormLoad:
Exit Sub

Err_FormLoad:
MsgBox "(" & Err.Number & ")- " & Err.Description, vbOKOnly,
Me.Name & " Form_Load"
Resume Exit_FormLoad


End Sub

Private Sub lstPlanes_Click()
'***********************************
'*
'*
'***********************************

Const strPlaneSQL1 As String = "SELECT Alignment.AlignmentTitle,
DimensionalPlane.Color, PlaneType.PlaneTypeDescription,
DimensionalPlane.Active FROM PlaneType INNER JOIN (DimensionalPlane
INNER JOIN Alignment ON DimensionalPlane.AlignmentId =
Alignment.AlignmentId) ON PlaneType.PlaneTypeID =
DimensionalPlane.PlaneType WHERE DimensionalPlane.PlaneId = "

Dim clsHldSQLCall As ADOWrapper

Dim strRecordSetArray() As String

On Error GoTo Err_lstPlanesClick

Me.lstPlaneNames.RowSource = "SELECT
DimensionalPlaneNames.PlaneName, DimensionalPlaneNames.TrueName,
DimensionalPlaneNames.PlaneId, DimensionalPlaneNames.PlaneNameId FROM
DimensionalPlaneNames " & _
"WHERE DimensionalPlaneNames.SubPlaneId
Is Null And DimensionalPlaneNames.PlaneId = " & Me.lstPlanes.Column(1,
Me.lstPlanes.ListIndex) & " ORDER BY DimensionalPlaneNames.PlaneName;"

Me.lstPlaneNames.Requery

Me.lstPlaneNames.Selected(0) = True

Set clsHldSQLCall = New ADOWrapper

clsHldSQLCall.SQLStatement = strPlaneSQL1 & Me.lstPlanes.Column(1,
Me.lstPlanes.ListIndex)

strRecordSetArray() = clsHldSQLCall.LoadData()

Set clsHldSQLCall = Nothing

Me.txtPlaneAlignment.Value = strRecordSetArray(1, 1)

Me.txtPlaneColor.Value = strRecordSetArray(1, 2)

Me.txtPlaneType.Value = strRecordSetArray(1, 3)

Me.chkPlaneActive.Value = strRecordSetArray(1, 4)

Me.lstSubPlanes.SetFocus

Me.lstSubPlanes.RowSource = "SELECT
DimensionalPlaneNames.PlaneName, DimensionalPlaneNames.PlaneId,
DimensionalPlaneNames.SubPlaneId FROM DimensionalPlaneNames " & _
"WHERE DimensionalPlaneNames.TrueName =
True And DimensionalPlaneNames.SubPlaneId Is Not Null And
DimensionalPlaneNames.PlaneId = " & Me.lstPlanes.Column(1,
Me.lstPlanes.ListIndex) & ";"

Me.lstSubPlanes.Requery

Me.lstSubPlanes.Selected(0) = True


Exit_lstPlanesClick:
Exit Sub

Err_lstPlanesClick:
MsgBox "(" & Err.Number & ")- " & Err.Description, vbOKOnly,
Me.Name & " lstPlanes_Click"
Resume Exit_lstPlanesClick

End Sub

Private Sub lstSubPlanes_Click()
'***********************************
'*
'*
'***********************************

On Error GoTo Err_lstSubPlanesClick

Me.lstSubPlaneNames.SetFocus

Me.lstSubPlaneNames.RowSource = "SELECT
DimensionalPlaneNames.PlaneName, DimensionalPlaneNames.TrueName,
SubDimensionalPlane.PlaneId, SubDimensionalPlane.SubPlaneId,
DimensionalPlaneNames.PlaneNameId FROM DimensionalPlaneNames INNER
JOIN SubDimensionalPlane ON (SubDimensionalPlane.PlaneId =
DimensionalPlaneNames.PlaneId) AND (DimensionalPlaneNames.SubPlaneId =
SubDimensionalPlane.SubPlaneId) WHERE SubDimensionalPlane.PlaneId = "
& Me.lstSubPlanes.Column(1, Me.lstSubPlanes.ListIndex) & " AND
SubDimensionalPlane.SubPlaneId = " & Me.lstSubPlanes.Column(2,
Me.lstSubPlanes.ListIndex) & ";"

Me.lstPlaneNames.Requery

Me.lstSubPlaneNames.Selected(0) = True

Me.lstSites.SetFocus

Me.lstSites.RowSource = "SELECT Sites.SiteId, Sites.SubPlaneId
FROM Sites WHERE Sites.SubPlaneId = " & Me.lstSubPlanes.Column(2,
Me.lstSubPlanes.ListIndex) & ";"

Me.lstSites.Requery

Me.lstSites.Selected(0) = True


Exit_lstSubPlanesClick:
Exit Sub

Err_lstSubPlanesClick:
MsgBox "(" & Err.Number & ")- " & Err.Description, vbOKOnly,
Me.Name & " lstSubPlanes_Click"
Resume Exit_lstSubPlanesClick

End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++

i am now not sure what is going on with the click event firing if it
is not because of the selected property

Hoping you have time

Thanks
 
Back
Top