Click on list box to populate another form

  • Thread starter spnz via AccessMonster.com
  • Start date
S

spnz via AccessMonster.com

Hi there

I am hoping for a little help (well alot of help really!!)

I am creating a database that I can use as a recipe database.

I have created a form that I use to search my database.(frmSearch)
It contains a listbox(lstSearchResults) that displays my search
results....My problem is I would like to be able to transfer my selected
search to the main form by the double-click property.

I would like to be able to select a recipe from the listbox and by double
clicking it. The code would pass my selected recipe on the main form so I
can view all the recipe details easily.



Can anyone help me out with a piece of code to transfer the double clicked
item on the list box to the main form.


TIA
 
S

Steve Schapel

Spnz,

Assuming that your database has a RecipeID to uniquely identify each
recipe, and assuming that this RecipeID is the bound column of the
lstSearchResults listbox...
DoCmd.OpenForm "Main Form", , , "[RecipeID]=" & Me.lstSearchResults
This should work whether the main form is already open or not.

Here's another approach, assuming the main form is already open...
DoCmd.SelectObject acForm, "Main Form"
With Forms![Main Form]
.Filter = "[whay]='" & Me.Text6 & "'"
.FilterOn = True
End With

I would tend to prefer a Click on a Command Button rather than Dbl Click
on the listbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top