Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Requery is giving No Results (and no Error)

Status
Not open for further replies.

aregan1

Programmer
Feb 12, 2002
46
US
Hi everyone -

A requery command for a subform on my main form is not giving me any results. But it's also giving no error, so I'm not sure where to turn. Here's the details:

I have a main form called "Tutor Hours", which contains an unbound combobox called "cboTutor", a subform called "Tutored Courses subform", and a few other unbound text boxes. The row source for the combobox is:

Code:
SELECT DISTINCT [BIOGRAPHIC INFO].IDBN, [BIOGRAPHIC INFO].LastName, [BIOGRAPHIC INFO].FirstName, [BIOGRAPHIC INFO].ClassYear, [BIOGRAPHIC INFO].SSN, [BIOGRAPHIC INFO].TERM
FROM [BIOGRAPHIC INFO], [MCAS TUTORS]
WHERE ((([BIOGRAPHIC INFO].LastName) Is Not Null) AND (([BIOGRAPHIC INFO].SSN)=[MCAS TUTORS].[SSN]))
ORDER BY [BIOGRAPHIC INFO].LastName;

The combobox is being populated correctly. When a user clicks on the desired tutor, I then want to populate the other text boxes on the main form, and also populate the subform. The following code is in the main form:

Code:
Private Sub cboTutor_AfterUpdate()

    Forms![TUTOR HOURS]![Tutored Courses subform].SetFocus
    Forms![TUTOR HOURS]![Tutored Courses subform].Form.Requery
    Forms![TUTOR HOURS].[cboTutor].SetFocus
 
End Sub

Private Sub cboTutor_Click()

    Me!FirstName = cboTutor.Column(2)
    Me!ClassYear = cboTutor.Column(3)
    Me!SSN = cboTutor.Column(4)
    Me!IDBN = cboTutor.Column(0)
    
    MsgBox "TUTOR HOURS SSN = " & [Forms]![TUTOR HOURS]![SSN]
    
'    Me![Tutored Courses subform].Form.Requery
    
'    DoCmd.Requery ("Tutored Courses subform")

End Sub

As you can see by the commented code, I've tried doing the requery statement a few different ways, and in both the Click and AfterUpdate events. Other threads on this topic suggested putting in the SetFocus statements. Nothing I've tried has giving me any results (and nothing has generated an error, either!)

The 4 other text boxes are being populated correctly, and the msgbox statement shows me that the SSN is being picked up correctly from the main form.

The recordsource for the subform is as follows:
Code:
SELECT [BIOGRAPHIC INFO].LastName, [BIOGRAPHIC INFO].FirstName, [Tutee Courses].*
FROM [Tutee Courses], [BIOGRAPHIC INFO]
WHERE ((([Tutee Courses].TutorSSN)=[FORMS]![TUTOR HOURS]![SSN]) AND (([Tutee Courses].SSN)=[BIOGRAPHIC INFO].[SSN]))
ORDER BY [Tutee Courses].[Course#], [Tutee Courses].Subject;

This query runs fine independently (after supplying the prompt with an SSN).

I don't know if it matters or not, but I originally did not have a record source for the main form. In case that's required, I tried using the table "Biographic Info" as the record source, even though it wasn't needed for any fields. There was no difference either way.

I hope I've explained my problem well enough. Can anyone offer any insight or suggestions? Thank you for any advice you can pass on...

- Anita

 
I figured out what I was doing wrong. I didn't have the "Link Master Fields" and "Link Child Fields" values entered correctly. Now it works just fine...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top