473,387 Members | 1,492 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.

Combo boxes on a form

I need some help figuring this one out. I'm sure I did something like it
awhile back

but I can seemed to find that database or remember how I did this. Any way,
the

database tables are currently as follows...

tblClients tblProperties tblProjects

ProjectID
PropertyID 1----------8 PropertyID
ClientID 1----8 ClientID |-8 ClientID
Client | PropertyLocation | Project
|__________________________| ...

The form I am working on is a project worksheet. The control source a query
of the

projects table. At the top is a combo box that is to contain all of the
client names

from tblClients. Once the user selects a client, a second combo box becomes
active

for the user to select a property. cboProperties is to only contain the
properties

associated with the selected client. At this point, the user can enter all
of the

appropriate project information.

As you can see from the diagram above, there is a one-to-many relationship
between

tblClients.ClientID and tblProperties.ClientID; a one-to-many relationship
between

tblProperties.PropertyID and tblProjects.PropertyID and I currently have a

one-to-many relationship between tblClients.ClientID and
tblProjects.ClientID. I am

thinking that putting ClienID in tblProjects is redundant but I don't think
that this

is necessary creating my problems. I could be wrong, however, but I don't
want to delete it from the table just yet if it is not necessary.

How should I go about setting up this forms RecordSource so that I can
accomplish this. I have tried setting it as a query the uses the three
tables with their inherent relationships but I do not get all of the
records...

SELECT tblClients.ClientID, tblClients.Client, tblProjects.ProjectID,
tblProjects.Project, tblClientProperties.PropertyID,
tblClientProperties.PhysicalAddress
FROM tblClientProperties INNER JOIN (tblClients INNER JOIN tblProjects ON
tblClients.ClientID = tblProjects.ClientID) ON (tblClients.ClientID =
tblClientProperties.ClientID) AND (tblClientProperties.PropertyID =
tblProjects.PropertyID);

I have tried to alter the join properties on each of the joined fields but
if I change them I get an error telling me that I have ambiguous outer
joins.
Apr 15 '07 #1
1 1646
okay, so one client may have many properties, and each property belongs to
one client. one property may have many projects, and each project belongs to
only one property. correct so far?

if so, then you're correct in that you should not have a ClientID foreign
key field in tblProjects. since each project belongs to a specific property,
and each property belongs to a specific client, each project is already
*indirectly but clearly* linked to a specific client.

to set up a data entry form to add/edit projects for existing properties,
you don't need to link any of the tables in a query, and you only need one
small line of code in a form. suggest the following:

an unbound main form; i'll call it frmMain. add an unbound combobox control,
with tblClients (or a query based on tblClients) as its' RowSource; i'll
call the control cboClients. make sure that the BoundColumn is the ClientID
field (if you're not familiar with combo box controls, read up on them in
Access Help). add a second unbound combobox, with a query based on
tblProperties as its' RowSource; i'll call it cboProperties. add criteria to
the ClientID field in the query, as

Forms!frmMain!cboClients

make sure the BoundColumn is PropertyID. add code to cboClient's AfterUpdate
event procedure, as

Me!cboProperties.Requery

now when you choose a client from cboClients, the properties list in
cboProperties is automatically filtered to match that client.

create a second form, bound to tblProjects; i'll call it frmProjects. in
frmMain Design view, add a subform control (from the Toolbox toolbar); i'll
call it ChildProjects. set the subform control's properties as

SourceObject: frmProjects
LinkChildFields: PropertyID
LinkMasterFields: cboProperties

now when you choose a property from cboProperties, the subform will be
automatically populated with only the project records for that property.

hth
"Kevin" <no**@email.comwrote in message
news:tL*********************@fe05.news.easynews.co m...
I need some help figuring this one out. I'm sure I did something like it
awhile back

but I can seemed to find that database or remember how I did this. Any
way,
the

database tables are currently as follows...

tblClients tblProperties tblProjects

ProjectID
PropertyID 1----------8 PropertyID
ClientID 1----8 ClientID |-8 ClientID
Client | PropertyLocation | Project
|__________________________| ...

The form I am working on is a project worksheet. The control source a
query
of the

projects table. At the top is a combo box that is to contain all of the
client names

from tblClients. Once the user selects a client, a second combo box
becomes
active

for the user to select a property. cboProperties is to only contain the
properties

associated with the selected client. At this point, the user can enter all
of the

appropriate project information.

As you can see from the diagram above, there is a one-to-many relationship
between

tblClients.ClientID and tblProperties.ClientID; a one-to-many relationship
between

tblProperties.PropertyID and tblProjects.PropertyID and I currently have a

one-to-many relationship between tblClients.ClientID and
tblProjects.ClientID. I am

thinking that putting ClienID in tblProjects is redundant but I don't
think
that this

is necessary creating my problems. I could be wrong, however, but I don't
want to delete it from the table just yet if it is not necessary.

How should I go about setting up this forms RecordSource so that I can
accomplish this. I have tried setting it as a query the uses the three
tables with their inherent relationships but I do not get all of the
records...

SELECT tblClients.ClientID, tblClients.Client, tblProjects.ProjectID,
tblProjects.Project, tblClientProperties.PropertyID,
tblClientProperties.PhysicalAddress
FROM tblClientProperties INNER JOIN (tblClients INNER JOIN tblProjects ON
tblClients.ClientID = tblProjects.ClientID) ON (tblClients.ClientID =
tblClientProperties.ClientID) AND (tblClientProperties.PropertyID =
tblProjects.PropertyID);

I have tried to alter the join properties on each of the joined fields but
if I change them I get an error telling me that I have ambiguous outer
joins.


Apr 15 '07 #2

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

Similar topics

1
by: FZ | last post by:
Hi Gang, I was wondering if a generous person might be able to walk me through what I believe is a pretty simple task. I actually have significant Access experience, but I haven't done it in...
0
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
1
by: Robert Neville | last post by:
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...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
5
by: jjyconsulting | last post by:
Newbie needing some help. I have a tblParticipants. The fields include gender, education_level, income, occupation etc., I'm trying to create a form where a user can run a query from the form and...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.