INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

problem passing dates

problem passing dates

(OP)
I need help on how to correctly identify dates from a form in queries.

I have

MainForm: ShopOpNavigation (used the wizard)
Subform: frmReports where the user enters txtFromDate and txtToDate

That is fine.

Reports:
Main Report: Report1 which has only titles for the report, no recordsource
Sub Report: Rpt1 which has it's own recordsource
Sub Report: Rpt2 which has a different recordsource

On the FrmReports, I have a button that opens the selected report with

CODE

StrWhere = "[dateadded] between #" & Me.txtfromdate & "# and #" & Me.txtToDate & "#"
 DoCmd.OpenReport "Report1", acViewPreview, , StrWhere 

The filter StrWhere passes to the mainreport fine but not the subreports.
I have read many different ways suggested to pass to the subreport but can't seem to get it to work.
the last one I was going to try was Duane's suggestion on a post

Between Forms!frmX!txtFromDate and Forms!frmX!txtToDate But do not know how to reference it properly.

I Tried:
Between Me!ShopOpNavigation.Form!frmReports.Form!txtFromDate and Me!ShopOpNavigation.Form!frmReports.Form!txtFromDate
I don't get any errors but I also don't get any records

If I run the report by itself (leaving frmreports open), I get an error

The expression On Open you entered as the event property setting produced the following error: Object or class does not support the set of events
Thanks
Lhuffst

RE: problem passing dates

(OP)
redid the reports for the umpteenth time :)

Form
frmReports, you fill in txtfromdate and txttodate.

Report1
Added 2 text boxes
TxtStart control source =[Forms]![frmReports]![txtfromdate]
txtEnd control source =[Forms]![frmReports]![txtToDate]

Recordsource is now: SELECT TblData.DateAdded, TblData.EnteredBy, TblData.SubmittedBy
FROM TblData;
Group is DateAdded

Rpt1 (first subreport)
uses a query that has
Between [Reports]![Report1]![TxtStart] And [Reports]![Report1]![TxtEnd] as criteria for the dateadded field

If I run this from frmreports, it runs fine.
When I run it from the navigation page (ShopOpNavigation), the subreport (rpt1) is blank.
What should I check?

RE: problem passing dates

(OP)
Finally (after days) of trying different things, I got it to work.

changed the following.

On Report 1
txtStart Control Source is now =[Forms]![ShopOpNavigation]![NavigationSubform].[Form]![txtfromdate]
txtEnd control source is now =[Forms]![ShopOpNavigation]![NavigationSubform].[Form]![txttodate]

had to change subform to navigationsubform.

Whew

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close