Solved

MS Access 2010 - pass a variable from a Listbox to report

Posted on 2011-09-12
5
581 Views
Last Modified: 2012-05-12
In a database that I created, there is a form called "Select Learner" with a list box called "Full Name".  I want to use the selection in the listbox as filter to run a report.  I have tried using the following criteria in the query for the report to filter but when the query runs I get an "Enter Parameters Value" popup.

[Form]![Select Learner].[Full Name]

 It appears that listbox value is being passed as null

How can I accomplish this?
0
Comment
Question by:jrayos1976
  • 3
5 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36523700
Need an "s" on form:

Forms![Select Learner].[Full Name]
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36523718
And depending on how you are using it, possible an exclamation point before Full Name:

Forms![Select Learner]![Full Name]
0
 

Author Comment

by:jrayos1976
ID: 36524288
It is till not working.  I tried an exclamation point as well.  Before runnig the query do I need to perform a save function once I select a value from the listbox.  The reason I ask, is everytime i open the form  nothing is selected.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36524397
If your listbox is bound to a field in the underlying table or query, possibly.

Can you post a sample of your database?
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 500 total points
ID: 36525562
Put this in the Report_Open event of the report with the problem

Private Sub Report_Open(Cancel As Integer)
MsgBox nz(Forms![Select Learner]![Full Name], "It thinks the listbox value is null!")
End Sub

If it thinks it is null, then you have a problem with something deep-sixing your listbox's value before the report even opens.
If you get a value, then your query isn't contructed correctly.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

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…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

948 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

18 Experts available now in Live!

Get 1:1 Help Now