Solved

How open form to selected record in a listbox

Posted on 2014-01-15
2
2,225 Views
Last Modified: 2014-01-16
I'm trying to open a form (form #2) to a selected record in a listbox in form #1.

Here is my code which doesn't work...

DoCmd.OpenForm "frmPlantedBayQtys", , , "[PlantedBayID] = " & Chr(34) & Me.ListBayQty.Column(1) & Chr(34)

Note that PlantedBayID in numberic.
0
Comment
Question by:SteveL13
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39784210
try this,

DoCmd.OpenForm "frmPlantedBayQtys", , , "[PlantedBayID] = " &  Me.ListBayQty.Column(1)


what values do you get in Me.ListBayQty.Column(1) ?
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39784360
Steve,

Are you really interested in the 2nd column of the listbox, or the one that is the bound column?  Listboxes are zero based, so by referring to column(1) you are actually looking at the 2nd column in the Listboxes RowSource.

is the field [PlantedBayID] a number or a string?  if it is a number, Capricorn1's example above should work.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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.

867 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

23 Experts available now in Live!

Get 1:1 Help Now