473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

List Box contents not changing for new records

I have searched, but can't find a thread that addresses this problem. I think I'm just overlooking something simple, but I'm stumped at this time. My problem is that I need to provide a list of order numbers that are associated with a piece of equipment. I have a Form (frmEquipment) that is bound to a table (tblEquipment). I have another table (tblOrderNumbers) that contains, among other things, a Foreign Key field (called EqptKey) to tblEquipment and a text field call OrderNumber. What I would like to do is populate a List Box with all of the Order Numbers that are associated with the entry in the tblEquipment table. For the Row Source Type, I have "Table/Query". For the Row Source, I have "SELECT DISTINCT OrderNumber FROM tblOrderNumbers WHERE [EqptKey] = RKey;", where Rkey is the name of the key to tblEquipment. My problem is that I get the same set of values in the List Box for every record (the ones that match the first record in the tblEquipment set). I want to populate the List Box with a different set of values for each record (i.e. the Order Numbers that match only the corresponding piece of equipment). What do I need to change to make it work?

Additional Info: I have the same problem whether I use Single Forms or Continuous Forms, but I really need to use Continuous Forms. I have a separate form that is also bound to tblEquipment in which I use a subform to add/display the Order Numbers. This works fine, but I cannot use a subform on the Form where I'm having the problem because subforms are not allowed with Continuous Forms (found that out the hard way).

Any help would be greatly appreciated. Thanks in advance.
Dec 17 '08 #1
3 2051
MMcCarthy
14,534 Expert Mod 8TB
In the On_Current event of the form you need to requery the list box. Assuming List box is called List1 the

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     Me!List1.Requery
  4.  
  5. End Sub
  6.  
This should work for either single or continuous forms.
Dec 18 '08 #2
Mary,

Thanks for the reply and suggestion. I didn't put the Requery in the Form_Current function originally because I thought it would only work when the record was active. In fact, that is the case. Your solution works fine for Single Form, but I was trying to get the List to populate differently for each record in Continuous Forms mode. Unfortunately, your solution doesn't do this. You still need to activate each record to show the Order Numbers for that particular record. What my users want is to see at a glance what the different Order Numbers are for each piece of equipment. Is it even possible to show different values in a List Box for each record in Continuous Forms mode?
Dec 18 '08 #3
NeoPa
32,556 Expert Mod 16PB
Tom,

You may find this (http://bytes.com/topic/access/insigh...s-dont-persist) helpful in understanding the situation better, if not finding an immediate solution.
Dec 18 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bruce | last post by:
On an HTML form, I have a select list that is fed dynamically with detail records when the master record is displayed on the form. There is also a second lookup list, and want to allow the user...
15
by: oom | last post by:
I am a bit of a newbie when it comes to python, when working with lists today I noticed some very odd behaviour, any suggestions welcome: Python 2.2.3 (#1, Nov 6 2003, 14:12:38) on linux2...
23
by: Fuzzyman | last post by:
Pythons internal 'pointers' system is certainly causing me a few headaches..... When I want to copy the contents of a variable I find it impossible to know whether I've copied the contents *or*...
0
by: David Stockwell | last post by:
Hi, I'm getting an error 'oops an error pop from an empty list' However I am printing the contents of the list right before i am attempting the pop and there are items in the list. The...
6
by: Harry Overs | last post by:
My program needs to take a pointer to BYTE array (unsigned char*) and convert it into a STL list so that each BYTE in the array has its own element in the list, i.e. if the array has hundred bytes...
13
by: na1paj | last post by:
here's a simple linked list program. the DeleteNode function is producing an infinit loop i think, but i can't figure out where.. #include <stdio.h> typedef struct { char *str; //str is a...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
7
by: =?Utf-8?B?RXZhbiBSZXlub2xkcw==?= | last post by:
I am a C++ programmer and have been learning C#. I have constructed a List<> and I want to iterate over it, altering each string in the list. In C++, I'd just create an iterator and walk the...
7
by: beginner | last post by:
Hi Everyone, I have a simple list reconstruction problem, but I don't really know how to do it. I have a list that looks like this: l= What I want to do is to reorganize it in groups,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.