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

List Box gives Null Values

P: n/a
I have a list box that is generated on a form by way of a
Parameter Query. Problem is whenever I try to refer to the list
box, i.e., to update the underlying table, I am getting a "null"
value from any row or field I refer to. Have tried using "after
update" events as well as a button click event to no avail. The
debug window always shows "null" values when I bring it up while
trying to examine my code\events. Is there a way to get back to
the underlying table\query from a list box created via a
parameter query??
If I need to clarify this a bit more let me know & I will try
to. Am only a casual user of access but seems to me that what I
am trying to do should be fairly straightforward. Has me
dumbfounded however.
Thanks for any help,
dc
Feb 24 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
How many columns are in the listbox? Which column is the Bound Column? The
listbox's Value will come from the Bound Column for the selected row.

What is the MultiSelect property (Other tab) of the listbox set at? If it is
at None, then you can only select one row at a time and the above statement
is true. If it is set to Simple or Extended, then you can select more than
one row at a time. The problem is that the listbox can have only one
"value", so getting the value of the listbox when it is set to allow
multiple selections doesn't work. Instead, you have to loop through the
ItemsSelected collection of the list box and get the value of each selected
row. The help file has a very good example of doing this. Search help on the
term ItemsSelected.

--
Wayne Morgan
MS Access MVP
"doncee" <no*****************@charter.net> wrote in message
news:Xn*************************@216.196.97.131...
I have a list box that is generated on a form by way of a
Parameter Query. Problem is whenever I try to refer to the list
box, i.e., to update the underlying table, I am getting a "null"
value from any row or field I refer to. Have tried using "after
update" events as well as a button click event to no avail. The
debug window always shows "null" values when I bring it up while
trying to examine my code\events. Is there a way to get back to
the underlying table\query from a list box created via a
parameter query??
If I need to clarify this a bit more let me know & I will try
to. Am only a casual user of access but seems to me that what I
am trying to do should be fairly straightforward. Has me
dumbfounded however.
Thanks for any help,
dc

Feb 24 '06 #2

P: n/a
Thanks for the reply. I only have 3 columns & the bound column
is the first one. I am not set for multiselect , shows "none" in
the other property list and am only intersted in one row at a
time right now. I have read the help file but am sure I am
missing something. I have had success in the past with combo
boxes but that will not work for this app. Thanks for the info.
dc

How many columns are in the listbox? Which column is the
Bound Column? The listbox's Value will come from the Bound
Column for the selected row.

What is the MultiSelect property (Other tab) of the listbox
set at? If it is at None, then you can only select one row
at a time and the above statement is true. If it is set to
Simple or Extended, then you can select more than one row
at a time. The problem is that the listbox can have only
one "value", so getting the value of the listbox when it is
set to allow multiple selections doesn't work. Instead, you
have to loop through the ItemsSelected collection of the
list box and get the value of each selected row. The help
file has a very good example of doing this. Search help on
the term ItemsSelected.


Feb 24 '06 #3

P: n/a
How are you referring to the listbox? Are you referring to it in code, in a
query, or in another control? What is the statement you are using where you
refer to it?

--
Wayne Morgan
MS Access MVP
"doncee" <no*****************@charter.net> wrote in message
news:Xn************************@216.196.97.131...
Thanks for the reply. I only have 3 columns & the bound column
is the first one. I am not set for multiselect , shows "none" in
the other property list and am only intersted in one row at a
time right now. I have read the help file but am sure I am
missing something. I have had success in the past with combo
boxes but that will not work for this app.

Feb 24 '06 #4

P: n/a
Thanks again for the reply. This is the " after update" code
that I have used but get an error that no records available:
-> Me.RecordsetClone.FindFirst "[memberID] = " & Me![List9]<--
The memberid is an expression field from the original query
underlying the parameter query I use to create the list box.
I have also tried the following as a click event on a
button but also get a null when check the value of the
[memberid] expression:
Dim db As Database
Set db = CurrentDb
Dim stDocName As String
Set rst = db.OpenRecordset("query3", dbOpenDynaset)
Me.Bookmark = Me.RecordsetClone.Bookmark
Debug.Print [MEMBERID]

The above gets me a Null in the immediate pane of the debug
window & of course no records found.
Does any of this make sense? I'm sure I've got something
ass-backwards but it seems I have used these codes before with
success. It seems as if I am losing my reference to the original
query after I create the list box from the parameter query.
Thanks again for your reply
dc
How are you referring to the listbox? Are you referring to
it in code, in a query, or in another control? What is the
statement you are using where you refer to it?


Feb 24 '06 #5

P: n/a
Do a

Debug.Print Me!List9

before the "Me.RecordsetClone.FindFirst..." and see what that gives you.

--
Wayne Morgan
MS Access MVP
"doncee" <no*****************@charter.net> wrote in message
news:Xn*************************@216.196.97.131...
Thanks again for the reply. This is the " after update" code
that I have used but get an error that no records available:
-> Me.RecordsetClone.FindFirst "[memberID] = " & Me![List9]<--
The memberid is an expression field from the original query
underlying the parameter query I use to create the list box.
I have also tried the following as a click event on a
button but also get a null when check the value of the
[memberid] expression:
Dim db As Database
Set db = CurrentDb
Dim stDocName As String
Set rst = db.OpenRecordset("query3", dbOpenDynaset)
Me.Bookmark = Me.RecordsetClone.Bookmark
Debug.Print [MEMBERID]

The above gets me a Null in the immediate pane of the debug
window & of course no records found.
Does any of this make sense? I'm sure I've got something
ass-backwards but it seems I have used these codes before with
success. It seems as if I am losing my reference to the original
query after I create the list box from the parameter query.
Thanks again for your reply
dc
How are you referring to the listbox? Are you referring to
it in code, in a query, or in another control? What is the
statement you are using where you refer to it?

Feb 26 '06 #6

P: n/a
Thanks again for your reply. I changed the bound column around
on the underlying table\query & all seems fine right now. Not
sure what was wrong with the bound column I was using but am now
finally able to access the records from the list box.
Thanks again
dc
"Wayne Morgan" <co***************************@hotmail.com>
wrote in
news:OA******************@newssvr13.news.prodigy.c om:
Do a

Debug.Print Me!List9

before the "Me.RecordsetClone.FindFirst..." and see what
that gives you.


Feb 26 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.