473,416 Members | 1,740 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,416 software developers and data experts.

Combo Box Query: Listing a subset - Revisited

The solution to my dilemma seems straight-forward, yet my mind has not
been forthcoming with a direct route. My Project form has a tab
control with multiple sub-forms; these distinct sub-forms relate
addresses (multiple addresses); companies, contacts, and tasks to each
project (one to many).

My challenge lies with the task sub-form which links to the Project
form through ProjID. The task record links back to the respective
master tables through ProjID, CompID, and ContID. No problems occur
with this link In other words, the task record generally holds actions
for the Project, Company, and Contact tables; or any combination
thereof.

The problem lies with combo boxes on the continuous form. I bounded
these combo boxes to CompID and ContID. They display the full company
name and full contact name. The combo boxes allow me to choose to a
Company and Contact for each Task record. Remember the actual Task
sub-form is linked to the Project through ProjID. A project may have
multiple task records (one to Many).
Both combo boxes have a query that display the full name bounded to
the ID field (example below); bound to column one. This part work
fine, but the combo box should list a subset of records for the
current project record. If you have XXX project, then companies
associated with XXX should drop down in the box; not all companies.

With Tom Ellison's help, I was able to create a query that listed a
subset of the data.

SQL Statement---------------------------------------------

SELECT tblComp.CompID, tblComp.CompName, trelCompProj.ProjID
FROM tblComp INNER JOIN trelCompProj ON tblComp.CompID =
trelCompProj.CompID
WHERE (((trelCompProj.ProjID)=[Forms]![frmTaggingProj].[txtProjID]))
ORDER BY tblComp.CompName;

--------------------------------------------------------------End

Then we added some code to requery the combo box and keep thing
current. Apparently, the combo boxes only listed the current subset
after the requery code.

Code-------------------------------------------------------------

Private Sub cboCompID_GotFocus()
Me!cboCompID.Requery
End Sub

--------------------------------------------------------------End

My next dilemma became apparent after closing the form and opening it
again. Upon navigating through some records with data on the Task
sub-form, the combo boxes does not display previously entered data
until you drop-down the list. Quiet frankly, I remember entering data
into this combo box and the table record has data. So where did it go?

Please understand that I use the database myself and my brain does not
fluidly cross from usage to development. So I do not realize the
apparent solution without beginning this dialogue. This solution may
be as simple as placing the requery code on the main form; yet I have
a performance hit when navigating through records. Can one avoid this
performance hit with a different approach? Hopefully, someone may
lead in the right direction. Please be as specific as possible since I
do not consider myself a full time developer.

Nov 12 '05 #1
1 2687
My question was answered in the original post. I placed requery code
on the main forms OnCurrent. Fortunately, the performance hit was not
significant using today's machines. I was hoping for some insight on
the scenario.

Code-------------------------------------------------------------
Private Sub Form_Current()
Forms!frmTaggingProj.Form!sfrmTaggingTasks!cboComp ID.Requery
Forms!frmTaggingProj.Form!sfrmTaggingTasks!cboCont ID.Requery
End Sub

--------------------------------------------------------------End

On Fri, 06 Feb 2004 14:42:21 -0800, Robert Neville
<robert_neville@y@h0o.com> wrote:
The solution to my dilemma seems straight-forward, yet my mind has not
been forthcoming with a direct route. My Project form has a tab
control with multiple sub-forms; these distinct sub-forms relate
addresses (multiple addresses); companies, contacts, and tasks to each
project (one to many).

My challenge lies with the task sub-form which links to the Project
form through ProjID. The task record links back to the respective
master tables through ProjID, CompID, and ContID. No problems occur
with this link In other words, the task record generally holds actions
for the Project, Company, and Contact tables; or any combination
thereof.

The problem lies with combo boxes on the continuous form. I bounded
these combo boxes to CompID and ContID. They display the full company
name and full contact name. The combo boxes allow me to choose to a
Company and Contact for each Task record. Remember the actual Task
sub-form is linked to the Project through ProjID. A project may have
multiple task records (one to Many).
Both combo boxes have a query that display the full name bounded to
the ID field (example below); bound to column one. This part work
fine, but the combo box should list a subset of records for the
current project record. If you have XXX project, then companies
associated with XXX should drop down in the box; not all companies.

With Tom Ellison's help, I was able to create a query that listed a
subset of the data.

SQL Statement---------------------------------------------

SELECT tblComp.CompID, tblComp.CompName, trelCompProj.ProjID
FROM tblComp INNER JOIN trelCompProj ON tblComp.CompID =
trelCompProj.CompID
WHERE (((trelCompProj.ProjID)=[Forms]![frmTaggingProj].[txtProjID]))
ORDER BY tblComp.CompName;

--------------------------------------------------------------End

Then we added some code to requery the combo box and keep thing
current. Apparently, the combo boxes only listed the current subset
after the requery code.

Code-------------------------------------------------------------

Private Sub cboCompID_GotFocus()
Me!cboCompID.Requery
End Sub

--------------------------------------------------------------End

My next dilemma became apparent after closing the form and opening it
again. Upon navigating through some records with data on the Task
sub-form, the combo boxes does not display previously entered data
until you drop-down the list. Quiet frankly, I remember entering data
into this combo box and the table record has data. So where did it go?

Please understand that I use the database myself and my brain does not
fluidly cross from usage to development. So I do not realize the
apparent solution without beginning this dialogue. This solution may
be as simple as placing the requery code on the main form; yet I have
a performance hit when navigating through records. Can one avoid this
performance hit with a different approach? Hopefully, someone may
lead in the right direction. Please be as specific as possible since I
do not consider myself a full time developer.


Nov 12 '05 #2

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

Similar topics

0
by: Greg Schiedler | last post by:
Ok so I'm a MySql newbie. I have a DB that I need to pull out only selected username(s) that end on secected pattern(s). Original Query all usernames. $q = "select $cols from RADONLINE...
4
by: Tim Marshall | last post by:
Does anyone have recommendations for the maximum number of records a combo box should return? I'm not talking about limits in Access itself, but rather for UI purposes, ie, what the average user...
4
by: Peter Tyler | last post by:
I am having a hard time trying to code around this. I have a checkbox field in a MSAccess table called "100Fund" which is identical in structure to other checkbox fields in the same table. I have...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
1
by: pedro8ae | last post by:
I have a table with multiple records and one field that determine wheter or not the record is in use (Yes/No). I create a Query to list all the Yes in that table BUT, when I list or run my query...
3
by: rhobson2 | last post by:
Hello, I wrote a database applicaiton using Access XP (2002) and everything has been working good for the client until they purchased a couple of new computers with Access 2003. The meetings...
4
by: tehgreatmg | last post by:
I have a from with combo boxes that have the record source set to fields in my database. The database is for computer inventory so some things like manufacturer and model repeat. I was wondering...
5
by: AdrianG | last post by:
I am trying to write a single SQL query that would retrieve the data that I need. For example, I have a table called Athletes that has 2 fields: name and sport containing the name of an athlete and...
3
by: RZ15 | last post by:
Hi guys, I have made a form with a combo box listing fields that a user can sort by. I have a code that works for this when i have 4 levels to sort by. It is the following: Private Sub...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.