My form is based on qryQuestionnaire. After going through the recordset, I want to do a requery with new parameters. The code that I am using to do that is given below. but for some reason after requery, my form does not show the new record set.
extractQuestions(2, Me!txtCycleForm, Me!txtPatientID, Me!txtSessionDate, Me!txtSessionID)
Me.Requery
Me.Refresh
Public Function extractQuestions(num As Integer, num2 As Integer, str1 As Integer, str2 As Date, str3 As Long)
Set dbs = CurrentDb
strQueryName = "qryQuestionnaire"
For Each q In dbs.QueryDefs
If q.Name = strQueryName Then
dbs.QueryDefs.Delete strQueryName
End If
Next
'leaving blank for readability
strSQL = ""
Set qryDef = dbs.CreateQueryDef(strQueryName, strSQL)
End function
extractQuestions(2, Me!txtCycleForm, Me!txtPatientID, Me!txtSessionDate, Me!txtSessionID)
Me.Requery
Me.Refresh
Public Function extractQuestions(num As Integer, num2 As Integer, str1 As Integer, str2 As Date, str3 As Long)
Set dbs = CurrentDb
strQueryName = "qryQuestionnaire"
For Each q In dbs.QueryDefs
If q.Name = strQueryName Then
dbs.QueryDefs.Delete strQueryName
End If
Next
'leaving blank for readability
strSQL = ""
Set qryDef = dbs.CreateQueryDef(strQueryName, strSQL)
End function