Greetings.
I am having trouble populating text data that represents data in my
table. Here's the setup:
There is a People Table (name, address, phone, ...)
peopleID = autonumber key
There is a Judge Table (information about judges)
judgeID = autonumber key
peopleID = key to tblPeople
There is an Events Table (an event represents a weekend competition-
usually 2 days)
There is a Trials Table (every event may have more than one Trial (a
Trial is a Dog Obedience Competition))
There is a TrialsClass Table (every Trial may have up to three different
Classes)
The tblTrialClass has the following fields:
trialclassID = autonumber key
trialID = ID of Trial (refers to record in tblTrials)
judgeID = ID of judge (refers to record in tblJudges, which in turn
has peopleID which refers to record in tblPeople)
class = integer(1=Novice, 2=Open, 3=Utility)
My goal: I would like to have an Events Form to dispaly Event
Information. I have an unbound form that has a combobox that will
enable the user to select an Event to display. Clicking on the right
button will open up the Events Display Window. This means that I need
to display Trial Information and TrialClass Information, also. The plan
is to have a form called frmEvents with a subform called sfrmTrials and
in sfrmTrials have a subform called sfrmTrailClass.
Here's the problem (the first of many, I'm sure):
I'm working on the innermost subform (sfrmTrialClass) and I want to
display two columns:
"CLASS" and "JUDGE NAME (CITY, STATE)"
Here's what I did (that did not work):
1. Created sfrmTrialClass (view is Continuous Forms)
2. Made bound controls (me![judgeID] and me![class) have "visible=no"
3. Created two unbound controls to display the text that I want:
txtClass (text box for Class) and cboJudge (combobox for Judge Name,
city, and state)
4. I set the recordsource for cboJudge to display the text that I want
(with SQL)...this sort of works ... I'll explain later.
5. To test the subform as a standalone form, I created some test data.
There are 12 records in tblTrialClass (and the necessary associated
records).
6. In the Form_Load( ) routine of the subform (sfrmTrialClass), I have
the following:
Private Sub Form_Load()
On Error GoTo Err_Form_Load
strProcName = "Form_Load" 'Global field for err msg
'Populate txtClass
Select Case Me!class
Case 1
Me!txtClass = "Novice"
Case 2
Me!txtClass = "Open"
Case 3
Me!txtClass = "Utility"
End Select
'Populate cboJudge
Me!cboJudge = Me!judgeID
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox "ERROR in " & strModName & "-" & strProcName & "( ): " & _
Err.Number & " " & Err.Description
Resume Exit_Form_Load
End Sub
*++++++++++++++++++++++++++++++++*
When I run the form (sfrmTrialClass), all the records display but have
the same txtClass ("Novice") and all have the same cboJudge data. The
data is from the 1st record. I then changed the visible property for
me![class] and me![judgeID] to verify that all records were being
displayed and all the records are being read and displayed because the
correct integer data was displayed, but the displayed text (populated by
the LOAD routine) is not correct.
Additional Notes:
The form is going to be used to display the data and to edit/add data.
I'm sure that when I get to the edit/add actions I will have to
synchronize the text fields (that the user will type in and the
underlying field that will be saved in the records. Probably will have
to do something in the AFTERUPDATE routines.
Can you help me display the appropriate text?
Thanks.
SueB
*** Sent via Developersdex http://www.developersdex.com ***