473,749 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repost (corrected explanation): Lengthy Error from Combobox

I went back to read my post and found an error in my description ...
here is the post, again, corrected:

The following error:

"The current field must match the join key '?' in the table that seves
as t the 'one' side of one-to-many relationship. Enter a record in the
'one' side table with the desired key value, and then make the entry
with the desired join key in the 'many-only' table."

... happens when I click on an entry of a combobox. HELP!!

Here's the background:

1. The form (frmDogScores) is for display and input of SCORES that a
contestant (in this case a dog)has earned at competitions. The form is
opened up when the user clicks on a command button (btnScores) in a
previous form with information about the contestant (frmDogs).

2. The frmDogScores form has DefaultView = Continuous Forms

3. Tables involved:
tblEvents (one-to-many to tblTrials)
tblTrials (one-to-many to tblTrialClass)
tblTrialClass (one-to-many to tblScores)
tblScores (many-to-one to tblDogs)
tblJudgeID (one-to-one to tblTrailClass)
tblPeople (one-to-one to tblPeople)
tblClasses (see below for how this table is connected)

Note: (all keys are defined as Long)
Note: Not all fields in each table are listed. Just the pertinant
fields.

tblScores has the following fields:
scoreID (primary key - autogen)
dogregnbr (foreign key - tblDogs)
trialClassID (foreign key - tblTrialClass)
score (integer)
level (text - single character - A, B, C)

tblDogs has the following fields:
dogregnbr (primary key)
peopleID (foreign key or owner)
formalname (text)
callname (text)

tblTrialClass has the following fields:
trialClassID (primary key)
trialID (foreign key - tblTrials)
judgeID (foreign key - tblJudges)
classID (foreign key - tblClasses)

tblTrials has the following fields:
trialID (primary key)
eventID (foreign key - tblEvents)
trialdt (date of trial - short date)
trialnbr (number - integer (1,2,3,...))

tblEvents has the follwoing fields:
eventID (primary key)
eventstartdt (short date)
eventenddt (short date)
eventname (text)
eventcity (text)
eventstate (text)

tblJudges has the following fields:
judgeID (primary key)
peopleID (foreign key - tblPeople)

tblPeople has the following fields:
peopleID (primary key)
fname (text)
midinit (text)
lname (text)

tblClasses has the following fields:
classID (primary key)
class (text: "Novice" or "Open" or "Utility")

I want to display the dogname at the top of the frmDogScores form and
display all the scores for that dog. Each score row should display the
event name, trial number, trial date, event city, event state, class,
level, and score.

Here's how I did it ... it almost works.

Form RecordSource:
SELECT tblScores.score ID, tblScores.dogre gnbr, tblScores.trial classID,
tblScores.score , tblScores.quali fied, tblScores.note,
tblScores.proce ssed, tblScores.proce sseddt, tblScores.level ,
tblTrialClass.j udgeID
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.event ID =
tblTrials.event ID) INNER JOIN ((tblClasses INNER JOIN tblTrialClass ON
tblClasses.clas sID = tblTrialClass.c lassID) INNER JOIN (tblPeople INNER
JOIN (tblDogs INNER JOIN tblScores ON tblDogs.dogregn br =
tblScores.dogre gnbr) ON tblPeople.peopl eID = tblDogs.peopleI D) ON
tblTrialClass.t rialclassID = tblScores.trial classID) ON
tblTrials.trial ID = tblTrialClass.t rialID
ORDER BY tblScores.dogre gnbr, tblTrials.trial dt, tblEvents.event name,
tblTrials.trial nbr, tblClasses.clas s;

Bound combobox in Form Header Section: cboDogInfo
cboDogInfo ControlSource: dogregnbr (tblScores)
cboDogInfo RowSource: SELECT tblDogs.dogregn br, [tblDogs].[formalname] &
" [" & [tblDogs].[callname] & "] " & "(" & [tblPeople].[fname] & " " &
[tblPeople].[midinit] & " " & [tblPeople].[lname] & " " &
[tblPeople].[suffix] & ")" AS doginfo
FROM tblPeople INNER JOIN tblDogs ON tblPeople.peopl eID =
tblDogs.peopleI D
WHERE (((tblDogs.remo ved)=False))
ORDER BY tblDogs.formaln ame;

Fields in each row/record:
Bound combobbox: cboEventInfo
cboEventInfo ControlSource: trialclassID (tblScores)
cboEventInfo RowSource: SELECT tblTrialClass.t rialclassID, " (" &
[tblTrials].[trialdt] & ") * " & [tblEvents].[eventname] & " * Trial #"
& [tblTrials].[trialnbr] & " * " & UCase([tblClasses].[class]) & " * " &
[tblEvents].[eventcity] & ", " & [tblEvents].[eventstate] AS eventinfo
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.event ID =
tblTrials.event ID) INNER JOIN (tblClasses INNER JOIN tblTrialClass ON
tblClasses.clas sID = tblTrialClass.c lassID) ON tblTrials.trial ID =
tblTrialClass.t rialID
ORDER BY tblTrials.trial dt, tblEvents.event name, tblTrials.trial nbr,
tblClasses.clas s;

Bound combobox: cboLevel
cboLevel ControlSource: level (tblScores)
cboLevel RowSourceTyepe: Value List
cboLevel RowSource: "A","B","C"

Bound textbox: score (tblScores)

Bound combobox: cboJudgeInfo
cboJudgeInfo ControlSource: judgeID (tblTrialClass)
cboJudgeInfo RowSource: SELECT tblJudges.judge ID, "Judge: " &
[tblPeople].[fname] & " " & [tblPeople].[midinit] & " " &
[tblPeople].[lname] & " " & [tblPeople].[suffix] AS judgeinfo
FROM tblPeople INNER JOIN tblJudges ON tblPeople.peopl eID =
tblJudges.peopl eID;
*************** *************** *************** *****
If a dog has scores then the form displays all info just fine. However,
when I go to the new record row and and attempt to select an item in the
cboEventInfo dropdown list, that's when I get the error message. The
information in the combobox list is correct, so the query is working.

I have been struggling with this for quite some time. Anybody want to
try to tackle this and give me a hint on how to fix it? Please keep in
mind that I am not a real Access/VBA programmer. I am pretty much
self-taught so please make no assumptions about my prior knowledge.
Thanks.
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
2 1818
Because tblScores is foreign keyed to both tblDogs and tblTrialClass if
needs to know *both* the foreign key fields (ie dogregnbr and trialClassID)
values at the time the record is created since, being foreign keys in
tblScores, they are both required fields.

This poses a problem when you want to populate those fields each
individually using a bound combo box.
A workaround is to make cboDogScores and cboEventInfo unbound controls.

To achieve that you could do it like this:
1) create a main form that is unbound
2) make frmDogScores a subform of the main form
3) cut cboDogInfo and cboEventInfo from frmDogScores, and paste them onto
the main form
Delete their ControlSource value to make them unbound.
4) set up link fields on the subform control as follows:
Link Child Fields: dogregnbr; trialClassID
Link MasterFields: cboDogInfo, cboEventInfo

HTH,
Ian.
"Susan Bricker" <sl*****@verizo n.net> wrote in message
news:vn******** *******@news.us west.net...
I went back to read my post and found an error in my description ...
here is the post, again, corrected:

The following error:

"The current field must match the join key '?' in the table that seves
as t the 'one' side of one-to-many relationship. Enter a record in the
'one' side table with the desired key value, and then make the entry
with the desired join key in the 'many-only' table."

.. happens when I click on an entry of a combobox. HELP!!

Here's the background:

1. The form (frmDogScores) is for display and input of SCORES that a
contestant (in this case a dog)has earned at competitions. The form is
opened up when the user clicks on a command button (btnScores) in a
previous form with information about the contestant (frmDogs).

2. The frmDogScores form has DefaultView = Continuous Forms

3. Tables involved:
tblEvents (one-to-many to tblTrials)
tblTrials (one-to-many to tblTrialClass)
tblTrialClass (one-to-many to tblScores)
tblScores (many-to-one to tblDogs)
tblJudgeID (one-to-one to tblTrailClass)
tblPeople (one-to-one to tblPeople)
tblClasses (see below for how this table is connected)

Note: (all keys are defined as Long)
Note: Not all fields in each table are listed. Just the pertinant
fields.

tblScores has the following fields:
scoreID (primary key - autogen)
dogregnbr (foreign key - tblDogs)
trialClassID (foreign key - tblTrialClass)
score (integer)
level (text - single character - A, B, C)

tblDogs has the following fields:
dogregnbr (primary key)
peopleID (foreign key or owner)
formalname (text)
callname (text)

tblTrialClass has the following fields:
trialClassID (primary key)
trialID (foreign key - tblTrials)
judgeID (foreign key - tblJudges)
classID (foreign key - tblClasses)

tblTrials has the following fields:
trialID (primary key)
eventID (foreign key - tblEvents)
trialdt (date of trial - short date)
trialnbr (number - integer (1,2,3,...))

tblEvents has the follwoing fields:
eventID (primary key)
eventstartdt (short date)
eventenddt (short date)
eventname (text)
eventcity (text)
eventstate (text)

tblJudges has the following fields:
judgeID (primary key)
peopleID (foreign key - tblPeople)

tblPeople has the following fields:
peopleID (primary key)
fname (text)
midinit (text)
lname (text)

tblClasses has the following fields:
classID (primary key)
class (text: "Novice" or "Open" or "Utility")

I want to display the dogname at the top of the frmDogScores form and
display all the scores for that dog. Each score row should display the
event name, trial number, trial date, event city, event state, class,
level, and score.

Here's how I did it ... it almost works.

Form RecordSource:
SELECT tblScores.score ID, tblScores.dogre gnbr, tblScores.trial classID,
tblScores.score , tblScores.quali fied, tblScores.note,
tblScores.proce ssed, tblScores.proce sseddt, tblScores.level ,
tblTrialClass.j udgeID
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.event ID =
tblTrials.event ID) INNER JOIN ((tblClasses INNER JOIN tblTrialClass ON
tblClasses.clas sID = tblTrialClass.c lassID) INNER JOIN (tblPeople INNER
JOIN (tblDogs INNER JOIN tblScores ON tblDogs.dogregn br =
tblScores.dogre gnbr) ON tblPeople.peopl eID = tblDogs.peopleI D) ON
tblTrialClass.t rialclassID = tblScores.trial classID) ON
tblTrials.trial ID = tblTrialClass.t rialID
ORDER BY tblScores.dogre gnbr, tblTrials.trial dt, tblEvents.event name,
tblTrials.trial nbr, tblClasses.clas s;

Bound combobox in Form Header Section: cboDogInfo
cboDogInfo ControlSource: dogregnbr (tblScores)
cboDogInfo RowSource: SELECT tblDogs.dogregn br, [tblDogs].[formalname] &
" [" & [tblDogs].[callname] & "] " & "(" & [tblPeople].[fname] & " " &
[tblPeople].[midinit] & " " & [tblPeople].[lname] & " " &
[tblPeople].[suffix] & ")" AS doginfo
FROM tblPeople INNER JOIN tblDogs ON tblPeople.peopl eID =
tblDogs.peopleI D
WHERE (((tblDogs.remo ved)=False))
ORDER BY tblDogs.formaln ame;

Fields in each row/record:
Bound combobbox: cboEventInfo
cboEventInfo ControlSource: trialclassID (tblScores)
cboEventInfo RowSource: SELECT tblTrialClass.t rialclassID, " (" &
[tblTrials].[trialdt] & ") * " & [tblEvents].[eventname] & " * Trial #"
& [tblTrials].[trialnbr] & " * " & UCase([tblClasses].[class]) & " * " &
[tblEvents].[eventcity] & ", " & [tblEvents].[eventstate] AS eventinfo
FROM (tblEvents INNER JOIN tblTrials ON tblEvents.event ID =
tblTrials.event ID) INNER JOIN (tblClasses INNER JOIN tblTrialClass ON
tblClasses.clas sID = tblTrialClass.c lassID) ON tblTrials.trial ID =
tblTrialClass.t rialID
ORDER BY tblTrials.trial dt, tblEvents.event name, tblTrials.trial nbr,
tblClasses.clas s;

Bound combobox: cboLevel
cboLevel ControlSource: level (tblScores)
cboLevel RowSourceTyepe: Value List
cboLevel RowSource: "A","B","C"

Bound textbox: score (tblScores)

Bound combobox: cboJudgeInfo
cboJudgeInfo ControlSource: judgeID (tblTrialClass)
cboJudgeInfo RowSource: SELECT tblJudges.judge ID, "Judge: " &
[tblPeople].[fname] & " " & [tblPeople].[midinit] & " " &
[tblPeople].[lname] & " " & [tblPeople].[suffix] AS judgeinfo
FROM tblPeople INNER JOIN tblJudges ON tblPeople.peopl eID =
tblJudges.peopl eID;
*************** *************** *************** *****
If a dog has scores then the form displays all info just fine. However,
when I go to the new record row and and attempt to select an item in the
cboEventInfo dropdown list, that's when I get the error message. The
information in the combobox list is correct, so the query is working.

I have been struggling with this for quite some time. Anybody want to
try to tackle this and give me a hint on how to fix it? Please keep in
mind that I am not a real Access/VBA programmer. I am pretty much
self-taught so please make no assumptions about my prior knowledge.
Thanks.
Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #2
Ian,

Thank you, so much for your reply. I wonder if I am understanding your
solution. By making a new main form that is unbound with cboDogInfo and
cboEventInfo unbound controls on the main form, and making frmDogScores
a subform on the main form, the only scrollable information left on the
subform will be 'score' and 'level'. That means that the scores for a
single dog at a single trial will be displayed. That means that for the
user to view additional scores for the same dog at other trials, they
will need to hit a navigational control or a command button to move
through all trials that the dog attended.

That's doable, but not what I had in mind. Bummers!!! I wanted to be
able to move through all the scores for a particular dog by scrolling up
and down (having - let's say around 15 scores viewable at a time), as is
possible with the continuous forms design.

What I did last night after I posted the original request for help, was
removed the cboJudgeInfo from the detail row. That was what was causing
the problem. To get the judges name I needed to get judgeID. To get
judgeID I needed to get from trialclassID to find judgeID and then using
the peopleID (tblPeople) to get the name of the judge.

By the way, in the OnClick event of cboEventInfo, I test for NewRecord
and if true, I assign the dogregnbr (that I have sitting in a variable
that was populated upon entry to the frmDogScores form from the OpenArgs
variable into the form). This way when I click on a chosen row of
cboEventInfo, I have both foreign keys.

I added the judge "stuff" to the cumbersome query in the RowSource of
cboEventInfo and added judgename to the display. It works the way I
wanted, but it is UGLY to look at. Becauase 'eventname' and 'class'
values are variable in length, the data doesn't line up so it's hard to
look at when there are many rows on the screen.

I am going to see if I can force the width of these pieces of
information inside the combobox display (inside the query) to be
constant so that the information lines up making it look like columns.

Of course, if you have another suggestion, feel free to let me know.

Again, thanks for the explanation and suggestion. I really appreciate
it.

Regards,
SueB

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3

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

Similar topics

0
1916
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the desired key value, and then make the entry with the desired join key in the 'many-only' table." ... happens when I click on an entry of a combobox. HELP!! Here's the background:
4
1582
by: Roy | last post by:
This was the code I used which was suggested by you.Can you help me here? The code works till before the recordset,RS2. After that it bombs with a error saying "item not found in this collection".I tried to add additional fields but to no avail. DataFeed_001 is a table with a single memo field .Feed _002 is the
0
2052
by: Doug | last post by:
This is a repost of an item that I still cannot resolve. I have 3 combo boxes. The first leads to the second to the third. When I have selected a value in the second box, the third box shows the available information based on the second combo box selection. But if I change my mind and select a different item in the second box, after the third box has been populated, the third box still retains the information that was previously...
1
1252
by: Wild Wind | last post by:
Hello, I posted this a few days back, but got no response, so I am reposting it. I have an event in my managed class which I declare as: __event void MyEvent(System::Byte (*fir) __gc); However, I find that when I build the class, I get very
11
2290
by: Steve B. | last post by:
How can I keep the ComboBox textbox empty of datasource items when my local application starts AND keep them empty even after the user clicks different Tabs on the form. I welcome any questions. The problem isn’t clearing the items from the CB textbox, the problem is I can’t keep them empty when the user moves around the Tabs on the form. Each Tab has more CB’s and, by the way of course, I need to keep user CB selections on each...
0
1668
by: Ken Powers | last post by:
Hello everyone, Sorry about the repost, my second VB.NET App is done with the exception of this error. I'm getting a strange error when I try to bind a combo box to a Dataset. Here's my code! Private Sub Get_Data() Try Dim sqlcmd = New SqlCommand("Select * from Utility order by
2
1310
by: Gerry | last post by:
I have a combo box and I can populate it with my class of dat (the class allows me to store each userid,username called - see code below I want the user to select the dropdown and see the username - but also determine the UserID from what was selected (using DisplayName from the combo box?? I can populate the combo box without problems - BUT the user sees "System.object" in each item of the combobox not the username ***here is my clas...
0
1170
by: Frank Rizzo | last post by:
I have an app that listen to data on a certain resource. Data can come in on this resource any time, so I have to listen for it the entire time. I wanted to see if what I have is thread-safe and makes sense. Consider the code below. The app starts and creates code to handle an even from the Listener class. The listener class creates a new thread (will call it thread BOB) inside it that listens to data. When the data arrives, it is received...
2
1525
by: EManning | last post by:
I posted a question on 5/5/08 asking how to trap an error caused by multiple users trying to access the same patient. Here's what I posted: "Using A2003. I've got an FE with a main form with a subform. The subform is a mixture of bound and unbound fields. The main form is unbound and all it has on it is a combobox to choose a patient's name. Once the patient is chosen, the subform refreshes to show that patient's data. The problem...
0
8996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
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
9388
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
9333
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
9254
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
8256
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
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...
1
3319
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

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.