Solved

Pass a parameter from a form to a query and run a report

Posted on 2013-01-13
2
349 Views
Last Modified: 2013-01-17
I am passing a parament name from a form to a query.  Below is my sql

SELECT [kwahudb_thru 0312partly].ID, [kwahudb_thru 0312partly].Date, [kwahudb_thru 0312partly].NAME_, [kwahudb_thru 0312partly].RECEIPT_Num, [kwahudb_thru 0312partly].[DEVELOPMENt fee], [kwahudb_thru 0312partly].REGISTRATI, [kwahudb_thru 0312partly].EASTER, [kwahudb_thru 0312partly].OTHER, [kwahudb_thru 0312partly].YR
FROM [kwahudb_thru 0312partly]
WHERE ((([kwahudb_thru 0312partly].NAME_)=[Forms]![FormquryName].[txtEnterNameHere]));

Its not working, what am I doing wtong?  It runs OK but no data shows on the report.

Thanks
0
Comment
Question by:Kdankwah
2 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 38772082
In the criteria box enter:

Forms!nameOfForm!nameOfFieldOnForm
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38772388
1.  Start out by removing the WHERE clause, does the report work then?  If not, then you have a larger problem than the WHERE clause.

2.  In your WHERE clause, start out by trying:

WHERE [kwahudb_thru 0312partly].[NAME_])=[Enter Name!]

and see whether that works.  It should popup a message "Enter Name" when you run the report.  If you enter a valid name then it should work.

3. Make sure that the name of the forms data control is exactly the way you have it written on:

WHERE [kwahudb_thru 0312partly].[NAME_]=[Forms]![FormquryName].[txtEnterNameHere]

It looks like the Form name 'FormquryName' should probably be replaced with the actual name of your form.  Although that could be the name of your form, it looks like it may be misspelled.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now