Solved

How open form to selected record in a listbox

Posted on 2014-01-15
2
2,485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 48

Expert Comment

by:Dale Fye
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

627 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