Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How open form to selected record in a listbox

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.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.