Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter to display records MS ACCESS 2010???

Status
Not open for further replies.

jmasm

Programmer
Sep 1, 2010
22
PT
Create a filter to display only those records that have the criteria required?
I'm using this code:

DoCmd.OpenForm "Formname"
Forms!Formname.Form.Filter = "Data = " & Me.Datacriteria
Forms!Formname.Form.FilterOn = True

When I run the program the following error appears:

Run-Time error '2448'
You can't assign value to this object.

Help please!!!
 
Have you tried this ?
DoCmd.OpenForm "Formname", , , "Data = " & Me.Datacriteria

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Works with only one criteria.
When I try to use more then one criteria with this code:

DoCmd.OpenForm "Formname", , , "Data1 = " & "'"& Me.Datacriteria1 &"'" And "Data2 = " & "'"& Me.Datacriteria2 &"'"

When I run the program the following error appears:
Run-Time error '13'
Type mismatch
 
I'd try this:
Code:
DoCmd.OpenForm "Formname", , , "Data1='" & Me.Datacriteria1 & "' And Data2='"& Me.Datacriteria2 & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top