473,883 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate combobox

DSR
Help Please... I would like to populate a combo box on a form with a
query that compares data from two tables. Any record that is unique in
table1 should continue to populate my combobox. The instant the record
appears also in table2 it should no longer be listed in my combo box.
This is not a key field in either of the tables. Basically what I am
trying to do is prevent the user from entering duplicate values even
though it is not a key field. I am trying to do this by limiting their
choices in the combo box. There is a legitimate reason for neither
field being a key.

Thanks for your help

Jan 22 '06
11 12320
"DSR" <dr*******@hotm ail.com> wrote in
news:11******** **************@ g47g2000cwa.goo glegroups.com:
The main form is based on tblSuInfo. This form displays, in
textboxes, field data called SuLastName, SuFirstName, and
SuIDNum. The Subform is based on tblSurProc. It is linked to
the main table, on the many side of one to many, by the field
called SurIDNum (AutoNumber in the parent table and number in
the child table).
Pretty normal.

The ComboBox , which is on the subform, is there to offer choices to the user to add to the CredProc
field on the child table (tblSurProc). There is a third table
in the database that holds a field called AllProcAvail. I want
my comboBox to reflect all Records from the third table's
field (ProcName) but only those that don't already appear in
the field (CredProc) in tblSurProc, but this must only reflect
the current recordset based on SurIDNum from the main table
(tblSurInfo).
So you want the combo to lookup all the procedures except ones
already assigned to the child records having their foreign key
equal to the primary key of the parent form,

Have I understood correctly? If so, your combobox rowsource
would be:
SELECT AllProcAvail.Pr ocName from AllProcAvail
WHERE ProcName NOT IN (SELECT CredProc from tblSurProc WHERE
SurIDNum = forms!mainform! surIDNum);

* I don't know the name of your form so I called it mainform.
Change as required.

Once that's there you need to requery the combobox when the
mainform's record changes, so in the OnCurrent event put
me!subform.form !comboboxname.r equery
The third table doesn't need a relationship to the others since it just holds All Proc Names. If a new Proc
name is added to this field it must be reflected in my
comboBox. This whole scenario should allow for a different
record set based on which current SurIDNum I am viewing on my
main form.

I hope this is clear enough and I really do appreciate your
help.


--
Bob Quintal

PA is y I've altered my email address.
Jan 22 '06 #11
DSR
I have it working now. I want to thank everyone that responded; each of
you helped tremendously.

Jan 25 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3262
by: Jassim Rahma | last post by:
Hi, what is the best way to populate comboBox from database.. the reason I am asking is that i have more than 8 comboBoxes in one form and each should retrieve data from a table and I don't want that to slow the form show. can you please submit a sample code...
0
2143
by: ROO | last post by:
Hi Everyone, I have a database table that have 4 field( C1, C2, M1, M2) on my form i have two combo box ComboC and ComboM C1 C2 M1 M2 1 Sales 1 Monthly Terms 1 Sales 2 Annual Terms
1
2217
by: Primera | last post by:
I'm trying to populate a ComboBox on Form.load with a list of the OU's pulled from AD. Here is the code that does not work: Dim rootdir As New System.DirectoryServices.DirectoryEntry _ ("LDAP://dc=corp,dc=abc,dc=com") Dim rootsearch As New System.DirectoryServices.DirectorySearcher(rootdir) Dim result As System.DirectoryServices.SearchResult rootsearch.SearchScope = DirectoryServices.SearchScope.Subtree rootsearch.Filter =...
16
10543
by: agrawal.solutions | last post by:
Hello Friends I am asking a very silly question but i dont find any solution fo this.. I am selectiong a recordset and want to populate a combobox where id would be inviseble and the content would. I am getting the recordset and the no of record but then i am unble to populate the combobox. I have already tried all the function starting form for each x in .... and while...wend and do....loop
0
4012
by: vnaz235 | last post by:
Hi, guys, 1. Can anybody help me to populate ComboBox on VB6 form with a) text strings from the range on the already existing Excel sheet (e.g., Workbook("Test1").Sheets("Sheet1").Range("P12:P72")) and another ComboBox with b) names of visible Excel sheets in the same workbook? 2. How to pass selected items from ComboBox1 into Workbook("Test1").Sheets("Sheet1").Range("A1") and from ComboBox2 into...
1
6009
by: freekedoutfish | last post by:
Hi. New member here Im sat at work, pounding my head off the desk because this tiny bit of simple code refuses to work. The sub is intended to pull data from the "companyname" column in the "cmSelectAllCompanyNames" table, and put all the company names it finds into the "cbFilterCompanyName" combo box. Now the confusing aspect is this: It works!!!
1
12726
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I've a column in a dataGridView set as combobox. I can't find any example showing how to populate the list in the combobox. Does anyone have an example showing me this. Regards Jesper.
4
5722
by: gobblegob | last post by:
hi guys, I would like to populate a combobox list with the contents of a folder which contains text files , which will later be opened. Thanks in advanced for any help :) Gobble.
1
2318
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
This actually stemmed from anther post I created. But, I have two combo boxes. ComboBox1 is populated by a list of Systems (DataSet from Oracle Query). Now, I want to take Combobox2, and when the data is changed on Combox1, I want to populate data depending on the selection in Combox1. So, ComboBox1 lists "OracleDB123". I want ComboBox2 to list all accounts on that system. That information is stored in say the Accounts
0
9792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10416
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5797
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.