473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing Value from the form to a report query

I have to pass a date from a form to a report query. I have written a
query that works fine when I execute from SQL view, But I dont know
how to pass a value from the form to this query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));
I search so many mails in this group, but I didn't find a simple
answer to my problem.

Thanks

Mike
Nov 13 '05 #1
7 2404
I'm not sure what the problem is, but if the query runs fine then the
report should also. Are you closing the form when you run the report?
If so, is hiding the form before opening the report an option? Will you
be using the form again?

Mike wrote:
I have to pass a date from a form to a report query. I have written a
query that works fine when I execute from SQL view, But I dont know
how to pass a value from the form to this query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));
I search so many mails in this group, but I didn't find a simple
answer to my problem.

Thanks

Mike


--
--------------------------------------
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Nov 13 '05 #2
Chris,

Thanks for the response.

Query runs fine in the Sql view because it prompts for date which I
enter and get the
desired output from the undermentioned query.
SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));

However, I need to pass this value from a form(text field) to this
query and once I click
on the show report button in the form, form closes and report pops up
with the results base on above query.

Actually, the application that I am trying to develop will need much
more complicated query
than the one shown above, but I have to go step by step.
Thanks

Mike

Chris Moore <cdmwebs@no_spam.hotmail.com> wrote in message news:<40F5CFBF.30307@no_spam.hotmail.com>...
I'm not sure what the problem is, but if the query runs fine then the
report should also. Are you closing the form when you run the report?
If so, is hiding the form before opening the report an option? Will you
be using the form again?

Mike wrote:
I have to pass a date from a form to a report query. I have written a
query that works fine when I execute from SQL view, But I dont know
how to pass a value from the form to this query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));
I search so many mails in this group, but I didn't find a simple
answer to my problem.

Thanks

Mike

Nov 13 '05 #3
Mike
However, I need to pass this value from a form(text field) to this
query and once I click
on the show report button in the form, form closes and report pops up ********* with the results base on above query.


As Chris already told you, don't close the form but hide it or do otherwise.
You can also close the form when the report is closed.

--
Hope this helps
Arno R

Nov 13 '05 #4

I change the command and now form does not close.
But I dont know why still

Forms!ReportForm!reportDate (where reportDate is a text field) is not
able to pass the value from the form to the report query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));

Is there any way to test what is being passed to the where clause in the
Form.

Please help I am stuck on this from 2 days...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
Sure there is... Just stick a MsgBox in right before the report
opens. In the report's open event, add:

MsgBox "The value is: " & Forms!ReportForm!reportDate

and see what you get.
Chris

Mike Panwar <mp******@yahoo.com> wrote in message news:<40**********************@news.newsgroups.ws> ...
I change the command and now form does not close.
But I dont know why still

Forms!ReportForm!reportDate (where reportDate is a text field) is not
able to pass the value from the form to the report query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));

Is there any way to test what is being passed to the where clause in the
Form.

Please help I am stuck on this from 2 days...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Nov 13 '05 #6
One other thing, Mike. I just read your post again and I see that
you're passing a date to your report. Make sure you wrap the date
with pound signs (#) in your code or use the CDate function in your
SQL.

WHERE (((Production.Date)=CDate(Forms!ReportForm!reportD ate)) And

Chris

Mike Panwar <mp******@yahoo.com> wrote in message news:<40**********************@news.newsgroups.ws> ...
I change the command and now form does not close.
But I dont know why still

Forms!ReportForm!reportDate (where reportDate is a text field) is not
able to pass the value from the form to the report query.

SELECT Production.Production
FROM Production
WHERE (((Production.Date)=Forms!ReportForm!reportDate) And
((Production.ShiftName)="Shift1"));

Is there any way to test what is being passed to the where clause in the
Form.

Please help I am stuck on this from 2 days...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Nov 13 '05 #7
Thanks Chris!!
I was able to solve the problem with your help.

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: zig | last post by:
I've posted this on alt.comp.lang.coldfusion, but is predominantly a javascript problem: I have a CF query which returns several rows of records. I wanted to have a checkbox on each record of...
7
by: rickcheney | last post by:
I just changed my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was clicked a Report was...
1
by: Michael DeLawter | last post by:
Using Access 2002. I have a chart in a report that is currently based on a query in which the user enters the start and end date for the chart to display. Both the start and end dates have been...
2
by: MX1 | last post by:
HELP! I have a query that gets a few values from a form. The problem I'm having is a date field in the query. When I put the value in the criteria, it works fine. When I put the same value as...
4
by: Greg Iocco | last post by:
Simple problem, but I've checked the newsgroups and couldn't find an answer. On the main swithboard is a command button to open a report. The report I built is based off a query, and the query...
1
by: rcmail14872 | last post by:
I used the upsize wizard to change my Access 2002 database to a SQL Server ADP project. I had a form where the user entered a value into a text box and when a command button on the form was...
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
4
by: AccessUser | last post by:
I have a form with a listbox control named A. I want to open a report based on the value selected in the drop down A( a query like SELECT fields FROM Table when table.field= value from A) How...
4
by: RachH | last post by:
Is there a way to pass a value to a report via VBA so the value can then be displayed in the report as a concantenation with a string? I have a report that displays all pricings that have occured...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.