By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,140 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,140 IT Pros & Developers. It's quick & easy.

listbox problem

P: n/a
Dear All,

Selecting 1 order in a listbox by code. Works OK, BUT
Opening a related form using Me.LstOrders.Column(0) as criteriavalue
sometimes triggers an error:
'There was a problem accessing a property or methode of the OLE object'

MsgBox Me.LstOrders.ItemsSelected.Count
MsgBox "[ORD_ID]= " & Me.LstOrders.Column(0)

When i insert these MsgBoxes before opening the form it shows:

1. If no error follows:
1
[ORD_ID]=1111
2. if error follow
1
[ORD_ID]=

In case 2 the selection is there but the value Me.LstOrders.Column(0) is not
accessible.

But why is it sometimes not accessible.

Reselecting the order manualy solves the problem.

THANKS,
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oh the joy of list boxes in Access - not a lot you can do except check to
see if the list box has a value in it before attempting to extract anything
from the Column property. This can be done by checking the listbox with
Isnull. For example:

If Not IsNull(lstOrders) Then
MsgBox lstOrders.Column(0)
End If

But to answer your question, I've no idea why Access is so fickle with
listbox selection :-/

"Filips Benoit" <be***********@pandora.be> wrote in message
news:VJ**********************@phobos.telenet-ops.be...
Dear All,

Selecting 1 order in a listbox by code. Works OK, BUT
Opening a related form using Me.LstOrders.Column(0) as criteriavalue
sometimes triggers an error:
'There was a problem accessing a property or methode of the OLE object'

MsgBox Me.LstOrders.ItemsSelected.Count
MsgBox "[ORD_ID]= " & Me.LstOrders.Column(0)

When i insert these MsgBoxes before opening the form it shows:

1. If no error follows:
1
[ORD_ID]=1111
2. if error follow
1
[ORD_ID]=

In case 2 the selection is there but the value Me.LstOrders.Column(0) is not accessible.

But why is it sometimes not accessible.

Reselecting the order manualy solves the problem.

THANKS,

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.