M
Marcia
I have a form (frmStudents) that I use to assign students to a class
by selecting the desired class from combo box list. I also have a
command button ("View Class") on the form that opens a second form
(frmClass) where the user can view more information about the class,
along with a subform datasheet listing all the assigned students in
that class. I created the "View Class" command button using the
wizard, and selected the option to "Open the form and find specific
data to display" (so the user will see the specific class that I
assigned the student to).
My Problem: When I use the command button to "View Class," the
newly-assigned student is NOT listed in the datasheet. But if I
close and re-open the first form (frmStudents) and then try it again,
the student IS listed.
This form will be used by others who may not know that they need to
close the first form and re-open it, so is there a way to refresh the
data automatically to include the new student?
I searched through previous newsgroup postings, and found references
to "Me.Requery," but I must not be putting the code in the right place
because it doesn't work for me.
Here is my current code for the "View Class" command button:
Private Sub cmdViewClass_Click()
On Error GoTo Err_cmdViewClass_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClasses"
stLinkCriteria = "[fldClassID]=" & Me![fldClassID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdViewClass_Click:
Exit Sub
Err_cmdViewClass_Click:
MsgBox "You Must Assign Student to a Class First"
Resume Exit_cmdViewClass_Click
End Sub
Does anyone know how I can refresh my data so that it will include the
new student without closing and reopening the first form?
Thanks!!
Jessi
by selecting the desired class from combo box list. I also have a
command button ("View Class") on the form that opens a second form
(frmClass) where the user can view more information about the class,
along with a subform datasheet listing all the assigned students in
that class. I created the "View Class" command button using the
wizard, and selected the option to "Open the form and find specific
data to display" (so the user will see the specific class that I
assigned the student to).
My Problem: When I use the command button to "View Class," the
newly-assigned student is NOT listed in the datasheet. But if I
close and re-open the first form (frmStudents) and then try it again,
the student IS listed.
This form will be used by others who may not know that they need to
close the first form and re-open it, so is there a way to refresh the
data automatically to include the new student?
I searched through previous newsgroup postings, and found references
to "Me.Requery," but I must not be putting the code in the right place
because it doesn't work for me.
Here is my current code for the "View Class" command button:
Private Sub cmdViewClass_Click()
On Error GoTo Err_cmdViewClass_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClasses"
stLinkCriteria = "[fldClassID]=" & Me![fldClassID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdViewClass_Click:
Exit Sub
Err_cmdViewClass_Click:
MsgBox "You Must Assign Student to a Class First"
Resume Exit_cmdViewClass_Click
End Sub
Does anyone know how I can refresh my data so that it will include the
new student without closing and reopening the first form?
Thanks!!
Jessi