Listbox rowsrc like textbox or combobox (1 Viewer)

gunslingor

Registered User.
Local time
Today, 06:32
Joined
Jan 13, 2009
Messages
50
Here's a link to a post I made a while back which can provide you with more background (see the relationships image at the top):
http://www.access-programmers.co.uk/forums/showthread.php?t=239883

So I got everything to work exactly as I wanted it to.. the listbox has its rowsrc manually changed via VB on form open or record change... so everytime the record changes or the form opens, VB creates a query string that pulls the TFE_Num and TFE_Name from the DB for only those records where the forms current key (me.key.value) equals the TFE_key values. And everything works.

The problem is that this VB based query is very slow... so everytime the record changes, we wait 1-5 seconds for this listbox to pull data and display it. My question is this: Is there a better way to do this, some way that doesn't require VB based SQL statement. I'm asking because all the non-listbox controls on the form use a control source and they get updated instantaniously on form open or record move, but the list boxes that are unbound and are populated using VB SQL are really slow... and there are really only 1 or 2 records ever displayed in the list box.

I have tried to set the rowsource for the list box within the properties tab and comment out the VB SQL code, but haven't succeeded. I suspect the issue is that the form is linked to all fields in the master table while the list box is linked to a 1st and 2nd generation child table... I just can't get it to work! I've tried simple adding the TFE tables and fields to the forms record source poperties, but when I do that I can only navigate to records that have TFEs associated with them.

I suspect I could resolve the issue myself, if only access queries allowed "me.key.value" to be used in the WHERE statement. Am I correct that you cannot do this in Accesses query builder or the SQL version? When I tried, it worked but then I notices the me.key.value got converted to a number (the first record) when it ran the first time.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:32
Joined
Feb 19, 2002
Messages
43,424
I don't understand why you need to change the RowSource every time the main form record changes. If there is a dependency, use a where clause in the RowSource query that references the controlling field on the main form. Changing the RowSources forces Access to do a lot of work. Using a where clause in the RowSource query does not.
 

Users who are viewing this thread

Top Bottom