I have a form "DirectoryItems" that contains a sub-form "FamDirItems" whose container name is "ContFamDirItems". The code below gets control when the user clicks on the label "Picture ID" you see in the design view of the "DirectoryItems" form (screen-shot below).
Code:
Private Sub ImageName_Click()
Select Case (SortColumn)
Case ""
Highlight ("ImageName")
Me.ContFamDirItems.Form.RecordSource = "QPicsNoDir"
'Me.RecordSource = "QPicsNoDir"
Case "ImageName"
Un_Highlight ("ImageName")
Me.ContFamDirItems.Form.RecordSource = "QDirOrPics"
'Me.RecordSource = "QDirOrPics"
SortColumn = ""
Case "lblImageFound"
Un_Highlight ("lblImageFound")
Highlight ("ImageName")
Me.ContFamDirItems.Form.RecordSource = "QPicsNoDir"
'Me.RecordSource = "QPicsNoDir"
End Select
Debug.Print Me.ContFamDirItems.Form.RecordSource
Me.ContFamDirItems.Form.Requery
With Me.RecordsetClone
Debug.Print .RecordCount
If .RecordCount = 0 Then MsgBox "No image names found that are un-accompanied by Directory checks."
End With
End Sub
The path taken in the above code is via Case "". The RecordSource is verified in that it displays "PicsNoDir" in the immediate window as expected. The statement Me.ContFamDirItems.Form.Requery you see executes as expected in A2003 and A2010 BUT NOT in A2007. No error is given. The record count value remains that of the initial load of the form at 236 records. Had the Requery run properly, the count would be 110 records. The display of the form "Directory Items" essentially shows an empty sub-form.
Below is a screen-shot of the design view of the form "Dirrectory Items", which hopefully will help make sense of what I'm saying here.
Is there some peculiarity about the Requery statement when run in A2007?
Thanks,
Bill