
Using Parameter Queries and Data Controls
Hi,
I am building a form that has a hidden bottom section that will contain all records for a given parent record on the top of
the form. When the user selects the button I.E. (<<<< Students) to expand the form, I set the recordset and querydef
objects, open the recordset and assign it to the data controls recordset property. When the user then selects the shrink
button I.E. (Students>>>>) the form returns to its normal size. The problem is that when they select the expand againd, I
get error 525 Data access error. I do not know what to do. Should I refresh the data control, and if I do, ho do I stop it
from wanting the parameters?
Here is the code that I am using for the Expand/Shrink Button
Private Sub cmdAddStudents_Click()
If cmdAddStudents.Caption = "Students >>>" Then
frmAddClass.Height = 7050
cmdAddStudents.Caption = "<<< Students"
Set studentQd = addDb.QueryDefs("qrygetstudent")
studentQd.Parameters!corpkeyparm = corpnum
Set studentRs = studentQd.OpenRecordset(dbOpenDynaset)
Set dataAddClass.Recordset = studentRs
Else
frmAddClass.Height = 4560
cmdAddStudents.Caption = "Students >>>"
studentRs.Close
studentQd.Close
Set studentRs = Nothing
Set studentQd = Nothing
End If
End Sub
Thanks in Advance
Mike Needham