List box problem

aqif

Registered User.
Local time
Today, 02:11
Joined
Jul 9, 2001
Messages
158
Hi
smile.gif


I've got a list box on my form and it is attached to a table Contacts. I've
got a button beside list box and it generates the latest contact data by
make table query ie it updates the contact table. The problem is that
When I press that button make table query does not run because table
is already being used by the list box on the form.

What I want is something like that

1. List box should be unbound (I have kept list box unbound)
2. Generate the new table by Select as query (I've done that)
3. Assign the table as row source of list box
4. Requery List box to populate values.

Only trouble is how to assign the row source to list box at run time. I've
tried to play with ListboxName.RowSource property but dont know abt
its usage. Any help will be appreciated.

Cheers!
Aqif
 
aqif,

The RowSource and RowSourceType properties can be set through code to allow the listbox to show data from a pre-defined table or query, or your own sql statment

For an existing table or query:
RowSourceType = "Table/Query"
RowSource = "YourTableOrQueryName"

For your custom sql query:
RowSourceType = "Table/Query"
RowSource = "select * from [YourTableOrQueryName];"

You can use any valid SELECT statment you like for the sql version.

Once you have set the properties above, you can then use the ListBox's Requery() method to load the data

Hope that helps,

axa
 

Users who are viewing this thread

Back
Top Bottom