Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2006

Tip: Looking for answers? Try searching our database.

List Box gives Null Values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
doncee - 24 Feb 2006 13:05 GMT
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
Wayne Morgan - 24 Feb 2006 14:41 GMT
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.

Signature

Wayne Morgan
MS Access MVP

>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
[quoted text clipped - 11 lines]
> Thanks for any help,
> dc
doncee - 24 Feb 2006 14:56 GMT
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
[quoted text clipped - 11 lines]
> file has a very good example of doing this. Search help on
> the term ItemsSelected.
Wayne Morgan - 24 Feb 2006 15:36 GMT
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?

Signature

Wayne Morgan
MS Access MVP

> 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.
doncee - 24 Feb 2006 16:07 GMT
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
a.s-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?
Wayne Morgan - 26 Feb 2006 02:42 GMT
Do a

Debug.Print Me!List9

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

Signature

Wayne Morgan
MS Access MVP

> Thanks again for the reply. This is the " after update" code
> that I have used but get an error that no records available:
[quoted text clipped - 23 lines]
>> it in code, in a query, or in another control? What is the
>> statement you are using where you refer to it?
doncee - 26 Feb 2006 09:53 GMT
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

> Do a
>
> Debug.Print Me!List9
>
> before the "Me.RecordsetClone.FindFirst..." and see what
> that gives you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.