J
jonefer
....But I can get the results if I do a DoCmd.OpenForm of the same nested form
I'm working in AC97 and almost finished - except I'd like the results to
show in a nested sub form within the same form instead of having to pop open
another form.
I've tried to requery,refresh the nested subform, but apparently to no avail..
All the code for this routine is below (happens when the user clicks a
member from a listbox)
'===============================
Dim strQry As String
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim lMRN As Long
Dim sGrp As String
Dim sSubG As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qMember")
strQry = ""
lMRN = Me.lstMemberResults
If Not IsNull(Me.lstMemberResults.Column(5)) Then
sGrp = Me.lstMemberResults.Column(5)
End If
If Not IsNull(sSubG = Me.lstMemberResults.Column(6)) Then
sSubG = Me.lstMemberResults.Column(6)
End If
'Adjust the query to explicitly select that member
If Len(sSubG) > 0 And Len(sGrp) > 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[GROUP] = '" & sGrp & "' AND [SGR] = '" & sSubG & "';"
End If
If Len(sSubG) = 0 And Len(sGrp) > 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[GROUP] = '" & sGrp & "';"
End If
If Len(sSubG) > 0 And Len(sGrp) = 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[SGR] = '" & sSubG & "';"
End If
If Len(sSubG) = 0 And Len(sGrp) = 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & ";"
End If
MsgBox "Trying: " & strQry
qdf.SQL = strQry
db.QueryDefs.Refresh
Me.Requery
Me.Refresh
'this part just doesn't work... the form doesn't refresh
Me.frmMemberDetails.Form.Visible = True
Me.frmMemberDetails.Form.Requery
Me.frmMemberDetails.Form.Refresh
Me.TabCtl4.Pages(3).SetFocus
'This works just fine...
' DoCmd.OpenForm "frmMemberDetails"
I'm working in AC97 and almost finished - except I'd like the results to
show in a nested sub form within the same form instead of having to pop open
another form.
I've tried to requery,refresh the nested subform, but apparently to no avail..
All the code for this routine is below (happens when the user clicks a
member from a listbox)
'===============================
Dim strQry As String
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim lMRN As Long
Dim sGrp As String
Dim sSubG As String
Set db = CurrentDb
Set qdf = db.QueryDefs("qMember")
strQry = ""
lMRN = Me.lstMemberResults
If Not IsNull(Me.lstMemberResults.Column(5)) Then
sGrp = Me.lstMemberResults.Column(5)
End If
If Not IsNull(sSubG = Me.lstMemberResults.Column(6)) Then
sSubG = Me.lstMemberResults.Column(6)
End If
'Adjust the query to explicitly select that member
If Len(sSubG) > 0 And Len(sGrp) > 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[GROUP] = '" & sGrp & "' AND [SGR] = '" & sSubG & "';"
End If
If Len(sSubG) = 0 And Len(sGrp) > 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[GROUP] = '" & sGrp & "';"
End If
If Len(sSubG) > 0 And Len(sGrp) = 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & " AND
[SGR] = '" & sSubG & "';"
End If
If Len(sSubG) = 0 And Len(sGrp) = 0 Then
strQry = "SELECT * FROM Membership WHERE [MRN] = " & lMRN & ";"
End If
MsgBox "Trying: " & strQry
qdf.SQL = strQry
db.QueryDefs.Refresh
Me.Requery
Me.Refresh
'this part just doesn't work... the form doesn't refresh
Me.frmMemberDetails.Form.Visible = True
Me.frmMemberDetails.Form.Requery
Me.frmMemberDetails.Form.Refresh
Me.TabCtl4.Pages(3).SetFocus
'This works just fine...
' DoCmd.OpenForm "frmMemberDetails"