Error when Filtering

  • Thread starter Thread starter McCoy
  • Start date Start date
M

McCoy

Recently I posted a question on filtering by fields. I have managed to
work this out,

With Me.Recordset
DoCmd.ApplyFilter , "RecordCode = UserInput"
End With

but now get an error

"Object Invalid or No Lognger Set"

The field 'RecordCode' that im using to search from is the masterfield
for a subform, as a result all the values in the subform contain
"#Name?" instead of their correct values. I assume the subform would
need to relocate its values after the filter has finished with the
'RecordCode' field.

Can anyone offer any solutions.

Thanks in advance

Please post all replies to m.p.a.forms
 
If UserInput is a number, try
DoCmd.ApplyFilter , "RecordCode = " & UserInput
otherwise try
DoCmd.ApplyFilter , "RecordCode = '" & UserInput & "'"

Hope This Helps
Gerald Stanley MCSD
 
Back
Top