Solved

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

Posted on 2013-01-13
2
355 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Expert Comment

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

Forms!nameOfForm!nameOfFieldOnForm
0
 
LVL 48

Accepted Solution

by:
Dale Fye 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

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

623 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