Thanks and sorry for late reply as I was out of office. I will try this.
ABK -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of John Viescas Sent: Monday, January 09, 2006 9:03 PM To: [email protected] Subject: RE: [ms_access] Date range ABK- The key is knowing that you can reference a control on a form as a paramter. First, you need an unbound form - let's call it "frmReportDates" - and two controls on the form to hold the dates - perhaps named txtDateFrom and txtDateTo. Use a date format in the Format property of these two controls. In the query that is the Record Source for your report, add two parameters that point to these controls. Under the date field in the query on the Criteria line, enter: BETWEEN [Forms]![frmReportDates]![txtDateFrom] AND [Forms]![frmReportDates]![txtDateTo] Add a command button to your unbound form. In the Click event procedure, do: Private Sub cmdRunReport_Click() ' Make sure user has entered both dates If IsNull(Me.txtDateFrom) Then MsgBox "You must enter a From date." Me.txtDateFrom.SetFocus Exit Sub End If If IsNull(Me.txtDateTo) Then MsgBox "You must enter a To date." Me.txtDateTo.SetFocus Exit Sub End If ' Open the parameter report DoCmd.OpenReport "rptMyReport", acViewPreview ' Hide this form Me.Visible = False End Sub .. note that you should change "rptMyReport" to the actual name of the report. In the Close event of the report, close the form: Private Sub Report_Close() DoCmd.Close acForm, "frmReportDates" End Sub John Viescas, author "Building Microsoft Access Applications" "Microsoft Office Access 2003 Inside Out" "Running Microsoft Access 2000" "SQL Queries for Mere Mortals" http://www.viescas.com/ -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Abu Bakkar Khan Chowdhury Sent: Sunday, January 08, 2006 9:32 PM To: [email protected] Subject: [ms_access] Date range Dear Friends I am new in Access. I have designed a database which contains date fields. I want to design a form where I can enter a data range so that I can get a report/query for specific date range. Pls Help ABK Yahoo! Groups Links Yahoo! Groups Links Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ms_access/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
