Changing data in a List using RecordSource

E

el zorro

I have an adp front end connected to a SQL Server back end. I have a list box
on a form (List129) with data based on a SQL view (ViewA). If the user checks
a box, I want to replace the data in the list with data brom another view
(ViewB). So I tried this in the "On CLick" event of the check box:

List129.RowSource = ViewB

Didn't work-- the list went blank. Any ideas? Thanks!
 
T

Tom van Stiphout

On Thu, 31 Jul 2008 17:04:00 -0700, el zorro

List129 is a HORRIBLE name, maybe that's why it's failing :)

Try this:
List129.RowSource = "ViewB"

Personally I would write this code in checkbox.AfterUpdate event.
I would also set a breakpoint on that line just to make sure it gets
executed.
We are assuming you can run the view interactively, or for example
have the wizard create a quick form based on this view, and all is
well.

-Tom.
Microsoft Access MVP
 
J

John W. Vinson/MVP

I have an adp front end connected to a SQL Server back end. I have a list box
on a form (List129) with data based on a SQL view (ViewA). If the user checks
a box, I want to replace the data in the list with data brom another view
(ViewB). So I tried this in the "On CLick" event of the check box:

List129.RowSource = ViewB

Didn't work-- the list went blank. Any ideas? Thanks!

I believe that - as in Access - the RowSource property of a listbox is
a text string. Try putting it in quotes.
 
E

el zorro

Thanks very much for your help-- using the quotes worked. BTW, you're right
about the name . I changed it-- to "List130." :)
 
Top