Changing data in a List using RecordSource

  • Thread starter Thread starter el zorro
  • Start date Start date
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!
 
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
 
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.
 
Thanks very much for your help-- using the quotes worked. BTW, you're right
about the name . I changed it-- to "List130." :-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top