Solved

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

Posted on 2011-09-12
5
594 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

773 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