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!

Building A query and printing. 1

Status
Not open for further replies.

lvengineer

Technical User
May 19, 2003
9
US
Hi Programmers,
As promised, I got my bonus for my database design! I will receive it in July and make a donation to the site. Thank you all for your assistance. You folks are awesome.
A new question: I'm very close to solving this but it isn't working:
Have a form with txtStartDate and txtEndDate text boxes.
Have a table with various fields. I want to build a query using a command button and use record.source to preview report. Neither my expression builder method nor my SQL code seems to work. I have seen similar threads but none with sufficient detail to solve the problem.
SQL code:
[Between [Forms]![frmGroup Report Form]!txtStartDate And [Forms]![frmGroup Report Form]!txtEndDate
SELECT [Exception Data Entry Table].Employee, Sum([Exception Data Entry Table].Credit) AS SumOfCredit
FROM [Exception Data Entry Table]
GROUP BY [Exception Data Entry Table].Employee;]

Any help will be appreciated. I'll be glad when I can write this stuff in VBA and VB6 code.
Thanks,
Bruce Weigman
 
Hi,
I do not understand the way that you are created the Sql. I will explain my idea of creating report using a query recordsource of it.

1 First you create a query from the table with whatever fields needed.Make sure to add the DateField in the Query.

2.On the form create a CommandButton to open the Report.

3 Again go to the Query in the design view and type exactly written below in the criteria of the field Date.
Between [Forms]![frmGroup Report Form]![txtStartDate] And [Forms]![frmGroup Report Form]![txtEndDate]

4 Enter the dates in the textboxes and click the commandbutton to open the Report.

ZmrAbdulla




 
Thank you ZmrAbdullah. I followed your directions exactly and the query sort of works. It does not extract (use) the dates in my form's text boxes but instead pops up forms for the user to input the dates. What am I missing here?
I do understand the criteria statement logically but the query doesn't seem to look at the form.

Thanks in advance,
Bruce Weigman
 
Hi,
What is your popup form asking for? It should be with a heading "Enter Parameter Value"
then a line like the criteria
[Forms]![frmGroup Report Form]![txtStartDate]
Make sure the names of the form and the text field are typed correctly.
Also make sure that you created the new report from the query that you created now.

ZmrAbdulla
 
Hello again ZmrAbdulla,
You are correct. The first pop up form is headed with
"Enter Parameter Value" followed by [Forms]![frmGroup Report Form]![txtStartDate].
The second pop up form is the same heading followed by [Forms]![frmGroup Report Form]![txtEndDate].
That is the crux of the problem. The query and the command button all work but.....
I don't want to use pop up forms. I want to enter the dates in text boxes. How do you attach the form's text boxes to the query? I am missing a basic point here...but I'm not sure what.
Thanks for all your help,
Bruce Weigman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top