Listbox Updating | | |
Why doesn't this code work:
-------------------------code snippet-----------------
Dim categorysource As String
categorysource = "SELECT [KSTUDY_KSTUDY].[KSTUDY_ID],
[KSTUDY_KSTUDY].[KSTUDY_CATEGORY], [KSTUDY_KSTUDY].[KSTUDY_WHO]" & _
" FROM KSTUDY_KSTUDY " & _
" WHERE [KSTUDY_KSTUDY].[PRSTUDY_ID] = " & Me.List0.Value
Me.List4.RowSource = categorysource
Me.List4.Requery
-------------------------code snippet--------------------
I put this as an afterupdate event. Basically, I have two listboxes.
LIST0 has a list of records from the KSTUDY_PRSTUDY table. There are
only 2 fields in this table. PRSTUDY_ID and CATEGORY. I display
Category, but hide the PRSTUDY_ID. PRSTUDY_ID, however, is the key
column, and is also the bound column. So, when I select one of the
categories, the value of P101, P102, etc is selected. All well and
good.
I put the above code in the AFTERUPDATE event of LIST0. Unfortunately,
it does appear to be updating the rowsource of LIST4 properly.. but I
can't, for the life of me, make it update the listbox and display
anything. It just sits there empty.
Any ideas? | | | | re: Listbox Updating
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Since the column PRSTUDY_ID is a char column, you have to delimit the
value in quotes:
"WHERE [KSTUDY_KSTUDY].[PRSTUDY_ID] = '" & Me!List0 & "'"
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQg1mB4echKqOuFEgEQKb4ACePhRkp7OsD7VbXwWW0t808l 995LoAn086
j5YdWkPxobekfYu1+rbUEFMD
=Pu9U
-----END PGP SIGNATURE-----
Basic wrote:[color=blue]
> Why doesn't this code work:
> -------------------------code snippet-----------------
> Dim categorysource As String
>
> categorysource = "SELECT [KSTUDY_KSTUDY].[KSTUDY_ID],
> [KSTUDY_KSTUDY].[KSTUDY_CATEGORY], [KSTUDY_KSTUDY].[KSTUDY_WHO]" & _
> " FROM KSTUDY_KSTUDY " & _
> " WHERE [KSTUDY_KSTUDY].[PRSTUDY_ID] = " & Me.List0.Value
>
> Me.List4.RowSource = categorysource
>
>
> Me.List4.Requery
> -------------------------code snippet--------------------
>
> I put this as an afterupdate event. Basically, I have two listboxes.
> LIST0 has a list of records from the KSTUDY_PRSTUDY table. There are
> only 2 fields in this table. PRSTUDY_ID and CATEGORY. I display
> Category, but hide the PRSTUDY_ID. PRSTUDY_ID, however, is the key
> column, and is also the bound column. So, when I select one of the
> categories, the value of P101, P102, etc is selected. All well and
> good.
>
> I put the above code in the AFTERUPDATE event of LIST0. Unfortunately,
> it does appear to be updating the rowsource of LIST4 properly.. but I
> can't, for the life of me, make it update the listbox and display
> anything. It just sits there empty.
>
> Any ideas?
>[/color] | | | | re: Listbox Updating
I'm not at work now to try it out.. (the tables are actually linked Oracle
tables.. so I can't play with it at home..) but I will try it when I get to
work and see what happens. Thanks a TON!
"MGFoster" <me@privacy.com> wrote in message
news:dCdPd.6423$UX3.2456@newsread3.news.pas.earthl ink.net...[color=blue]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Since the column PRSTUDY_ID is a char column, you have to delimit the
> value in quotes:
>
> "WHERE [KSTUDY_KSTUDY].[PRSTUDY_ID] = '" & Me!List0 & "'"
>
> --
> MGFoster:::mgf00 <at> earthlink <decimal-point> net
> Oakland, CA (USA)
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP for Personal Privacy 5.0
> Charset: noconv
>
> iQA/AwUBQg1mB4echKqOuFEgEQKb4ACePhRkp7OsD7VbXwWW0t808l 995LoAn086
> j5YdWkPxobekfYu1+rbUEFMD
> =Pu9U
> -----END PGP SIGNATURE-----
>
>
> Basic wrote:[color=green]
>> Why doesn't this code work:
>> -------------------------code snippet-----------------
>> Dim categorysource As String
>>
>> categorysource = "SELECT [KSTUDY_KSTUDY].[KSTUDY_ID],
>> [KSTUDY_KSTUDY].[KSTUDY_CATEGORY], [KSTUDY_KSTUDY].[KSTUDY_WHO]" & _
>> " FROM KSTUDY_KSTUDY " & _
>> " WHERE [KSTUDY_KSTUDY].[PRSTUDY_ID] = " & Me.List0.Value
>>
>> Me.List4.RowSource = categorysource
>>
>>
>> Me.List4.Requery
>> -------------------------code snippet--------------------
>>
>> I put this as an afterupdate event. Basically, I have two listboxes.
>> LIST0 has a list of records from the KSTUDY_PRSTUDY table. There are
>> only 2 fields in this table. PRSTUDY_ID and CATEGORY. I display
>> Category, but hide the PRSTUDY_ID. PRSTUDY_ID, however, is the key
>> column, and is also the bound column. So, when I select one of the
>> categories, the value of P101, P102, etc is selected. All well and
>> good.
>>
>> I put the above code in the AFTERUPDATE event of LIST0. Unfortunately,
>> it does appear to be updating the rowsource of LIST4 properly.. but I
>> can't, for the life of me, make it update the listbox and display
>> anything. It just sits there empty.
>>
>> Any ideas?
>>[/color][/color] |  | Similar Microsoft Access / VBA bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,467 network members.
|