filter report based on text box

daameta

Registered User.
Local time
Today, 06:47
Joined
May 26, 2015
Messages
25
hi all
i have a database which have tbl1 with field admission year with data like august/2007, august/2008. i have entered all data with help of form1. my problam is that i want filter report. user click a button so a form opened and than he entered data in a text box like august/2007 when he click on show report button only those pages which have august/2007 text will display in report. second time when user change text like august/2008 in text box report also show changes.
anybody who know how its possible please solve it.
 
on your form button use the where parameter of docmd.openreport

docmd.OpenReport "myreport",,,"mydate=" & me.txtbox
 
on your form button use the where parameter of docmd.openreport

docmd.OpenReport "myreport",,,"mydate=" & me.txtbox

hi let me explain in brief i have text box "admission month/year" in form1. in report name as (report2007) it show all record. i want to filter these record. like august/2007 or august/2008 so i want to use text box "admission mont/year" or cmd button for these please check it and show me correct code presently i use these code DoCmd.Openreport "report2007", , , "FieldName = " & Me.ControlName
 
DoCmd.Openreport "report2007", , , "FieldName = " & Me.ControlName

in principle, yes but if 'fieldname' is a text field then you need to enclose the controlname with single quotes

"FieldName = '" & Me.ControlName & "'" [/QUOTE]

and clearly, 'FieldName' needs to be the name of the field you are searching on and Me.ControlName needs to be the name of your control where the value you are search in has been entered

you can put this code behind a button or the afterupdate event of ControlName
 
thanks for both of you,
i solved my issue with parameter query. its great. presently i am asking a new question. like i have three txt box txt01, txt02, txt03 with text datatype. or a cmd button name as cmd1. i have a form name as form1. and report name as "report2007".
all three text box unbound. so which exact code i use to filter data in report. like parameter query. my query name is "query1". thanks advance.
 

Users who are viewing this thread

Back
Top Bottom