M
Matthew DeAngelis
Hello,
I am coding a button that will filter a recordset and pass that
recordset to the form. I have tested the filter and it works fine but,
when I try to pass the recordset to the form, I get the following error:
"Runtime error '3251': Operation is not supported for this type of
object." The help file says this means that this action is normally
supported, but is not in this specific instance. Here is the code
snippet I am using:
Dim rst As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim stDocName As String
stDocName = "frm: AllCompanies"
Set cnn = CurrentProject.Connection
rst.Open "[qry: frmPrincipalSearch]", cnn, adOpenDynamic
rst.Filter = "Principal Like *" & Forms!frmSearch!Principal & "*"
DoCmd.OpenForm stDocName
With Forms![frm: AllCompanies]
.Recordset = rst
End With
The debugger highlights the .Recordset = rst line. Does anyone know
what I am doing wrong? Please note that I am very new to working with
recordsets!
Thanks,
Matt
I am coding a button that will filter a recordset and pass that
recordset to the form. I have tested the filter and it works fine but,
when I try to pass the recordset to the form, I get the following error:
"Runtime error '3251': Operation is not supported for this type of
object." The help file says this means that this action is normally
supported, but is not in this specific instance. Here is the code
snippet I am using:
Dim rst As New ADODB.Recordset
Dim cnn As ADODB.Connection
Dim stDocName As String
stDocName = "frm: AllCompanies"
Set cnn = CurrentProject.Connection
rst.Open "[qry: frmPrincipalSearch]", cnn, adOpenDynamic
rst.Filter = "Principal Like *" & Forms!frmSearch!Principal & "*"
DoCmd.OpenForm stDocName
With Forms![frm: AllCompanies]
.Recordset = rst
End With
The debugger highlights the .Recordset = rst line. Does anyone know
what I am doing wrong? Please note that I am very new to working with
recordsets!
Thanks,
Matt