Solved

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

Posted on 2013-01-13
2
348 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
Comment Utility
In the criteria box enter:

Forms!nameOfForm!nameOfFieldOnForm
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

13 Experts available now in Live!

Get 1:1 Help Now