C
CSDunn
Hello,
I have a combo box (Combo7) that needs to call a function during the After
Update event of the combo box. The function resides in an Access 2000 ADP
Module called MMAnswerData_code.
The following is the code of the function:
Public Function SubFormRS(FrmTarget As Object)
Forms!frmAD_OpeningForm!FrmTarget.RecordSource = "EXEC
dbo.AdSubFormRecSource " & Forms!frmAD_OpeningForm!SubFormFilter
End Function
The function takes a form object as its argument and attempts to set the
record source of the form to the records returned by a SQL Server 2000 Proc
called 'ADSubFormRecSource'. This Proc takes a parameter called
'@SubFormFilter varchar(19)'. The parameter gets its value from
Forms!frmAD_Opening!SubFormFilter. 'SubFormFilter' is a text box on the main
form that that uses three concatenated values from a total of three combo
boxes to form the parameter required by @SubFormFilter.
The After Update event of Combo7 looks like this:
*******************
Private Sub Combo7_AfterUpdate()
If Me.Combo4 = "HMR3" And Me.Combo2 = "01" Then
SubFormRS (frmG1_HMR3_Q3)
End If
Me.Combo11.RowSource = "EXEC dbo.ADStudentCombo_sp " & Me.Combo7
******************
Combo7 also sets the rowsource of another combo box during the AfterUpdate
event. The parameter being sent to the SubFormRS is the name of a form.
The Proc (at a high level) looks like this:
******************************
Create Procedure ADSubformRecSource_sp
@SubFormFilter varchar (19)
AS
Select *
From tblADRawAnswerData AD
Left Outer Join Student_Data_Main SD On SD.Permnum = AD.Permnum
Inner Join Teacher_Data_Main TD On TD.TeacherID = SD.TeacherID
Where SD.Status is null
and
AD.TestShortName + Cast(AD.TestGrade as Varchar(2)) + TD.TeacherID =
@SubFormFilter
******************************
I have tested the Proc with a parameter, and the proc works fine.
When I make a selection from Combo 7, I don't get an error message, but it
is evident that there is no recordset for the subform (the bound text box
controls in the subform all have '#Name?' in them).
What can I do so that when a selection is made from combo7, the record
source of the subform populates with records per the Proc parameter?
Thanks for your help!
CSDunn
I have a combo box (Combo7) that needs to call a function during the After
Update event of the combo box. The function resides in an Access 2000 ADP
Module called MMAnswerData_code.
The following is the code of the function:
Public Function SubFormRS(FrmTarget As Object)
Forms!frmAD_OpeningForm!FrmTarget.RecordSource = "EXEC
dbo.AdSubFormRecSource " & Forms!frmAD_OpeningForm!SubFormFilter
End Function
The function takes a form object as its argument and attempts to set the
record source of the form to the records returned by a SQL Server 2000 Proc
called 'ADSubFormRecSource'. This Proc takes a parameter called
'@SubFormFilter varchar(19)'. The parameter gets its value from
Forms!frmAD_Opening!SubFormFilter. 'SubFormFilter' is a text box on the main
form that that uses three concatenated values from a total of three combo
boxes to form the parameter required by @SubFormFilter.
The After Update event of Combo7 looks like this:
*******************
Private Sub Combo7_AfterUpdate()
If Me.Combo4 = "HMR3" And Me.Combo2 = "01" Then
SubFormRS (frmG1_HMR3_Q3)
End If
Me.Combo11.RowSource = "EXEC dbo.ADStudentCombo_sp " & Me.Combo7
******************
Combo7 also sets the rowsource of another combo box during the AfterUpdate
event. The parameter being sent to the SubFormRS is the name of a form.
The Proc (at a high level) looks like this:
******************************
Create Procedure ADSubformRecSource_sp
@SubFormFilter varchar (19)
AS
Select *
From tblADRawAnswerData AD
Left Outer Join Student_Data_Main SD On SD.Permnum = AD.Permnum
Inner Join Teacher_Data_Main TD On TD.TeacherID = SD.TeacherID
Where SD.Status is null
and
AD.TestShortName + Cast(AD.TestGrade as Varchar(2)) + TD.TeacherID =
@SubFormFilter
******************************
I have tested the Proc with a parameter, and the proc works fine.
When I make a selection from Combo 7, I don't get an error message, but it
is evident that there is no recordset for the subform (the bound text box
controls in the subform all have '#Name?' in them).
What can I do so that when a selection is made from combo7, the record
source of the subform populates with records per the Proc parameter?
Thanks for your help!
CSDunn