Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

List box row source query not picking up form reference

Posted on 2006-11-28
3
Medium Priority
?
252 Views
Last Modified: 2010-05-18
Hi

I have a list box on a sub form.  The criteria for the row source query of the list box is set to the value of another control on the sub form as follows:

[Forms]![frmCompanies]![chdAddresses]![txtCompanyAddress_ID]

The problem is that no values are being displayed in the list box when they should be.  I have checked all the obvious.  If I substitute the above for an actual value then it works fine.  I have had this problem before but never been able to solve it - I have used the identical setup in other dbs and it has worked fine.  I can only conclude it is some sort of bug.

I am using Access 2003 on XP Pro

Any ideas??

Many thanks

Ken
0
Comment
Question by:kenabbott
3 Comments
 
LVL 17

Accepted Solution

by:
Natchiket earned 2000 total points
ID: 18026506
It may the way you are formulating the reference to the field

[Forms]![frmCompanies]![chdAddresses]![txtCompanyAddress_ID]

try

[Forms]![frmCompanies]![chdAddresses].Form![txtCompanyAddress_ID]

Where chdAddresses is the name of the subform on frmCompanies and txtCompanyAddress_ID is the name of the field within the subform
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 18026773
" I have checked all the obvious."

sorry to repeat, but have you checed the list control format to ensure that its column widths are not set 0cm;2.54cm...

effectively hiding the 1st columns.

that always catches me if i use the wizard to create the control, and  it autohides the key column and then i later chang emy mind about the number and order of columns.
0
 

Author Comment

by:kenabbott
ID: 18026794
Fixed!  Adding the .Form! before the control name did the trick.  many thanks
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

916 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