Selecting Double Click on Value

F

Futbol

On my list box (name is lstResults), when i double click it brings up a form
using the statement below.

DoCmd.OpenForm "EditRecord-SUW", , , "[ID] = 8", acFormEdit

The command above works, it brings up record #8. I would like to bring up
the actual record I double clicked on. Any help is much appreciated.

Thanks
 
S

Steve Schapel

Futbol,

Do you mean this?...
DoCmd.OpenForm "EditRecord-SUW", , , "[ID] =" & Me.lstResults

Not sure why, but I would somehow intuitively avoid using the DblClick
event of a listbox. Would the After Update event serve your purpose
just as well, activated when you make the selection in the listbox?
 
S

strive4peace

Hi

try this:

DoCmd.OpenForm "EditRecord-SUW", , , "[ID] = " &
me.lstResults, acFormEdit

this is assuming that the bound column of the listbox is
your ID field

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
F

Futbol

Thanks for the After Update suggestion, I changed it.
I am getting a RunTime Error 2501 after clicking on the record.

Steve Schapel said:
Futbol,

Do you mean this?...
DoCmd.OpenForm "EditRecord-SUW", , , "[ID] =" & Me.lstResults

Not sure why, but I would somehow intuitively avoid using the DblClick
event of a listbox. Would the After Update event serve your purpose just
as well, activated when you make the selection in the listbox?

--
Steve Schapel, Microsoft Access MVP
On my list box (name is lstResults), when i double click it brings up a
form using the statement below.

DoCmd.OpenForm "EditRecord-SUW", , , "[ID] = 8", acFormEdit

The command above works, it brings up record #8. I would like to bring
up the actual record I double clicked on. Any help is much appreciated.

Thanks
 
F

Futbol

I tried what you got below.

On the properties of the listbox

ControlSource = =[List of SUW]!ID
RowSourceType = Table/Query
RowSource = ListOfSUW (SQL Query for this is

SELECT [Sales & UW].[Last Name], [Sales & UW].[First Name], [Sales &
UW].Competitor, [Sales & UW].[Title/Segment], [Sales & UW].[Date of
Contact], [Sales & UW].ID
FROM [Sales & UW]
ORDER BY [Sales & UW].[Last Name];

I am getting the error "control can't be edited; it's bound to the
expression '[List of SUW]![ID]'



strive4peace said:
Hi

try this:

DoCmd.OpenForm "EditRecord-SUW", , , "[ID] = " & me.lstResults, acFormEdit

this is assuming that the bound column of the listbox is your ID field

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)

On my list box (name is lstResults), when i double click it brings up a
form using the statement below.

DoCmd.OpenForm "EditRecord-SUW", , , "[ID] = 8", acFormEdit

The command above works, it brings up record #8. I would like to bring
up the actual record I double clicked on. Any help is much appreciated.

Thanks
 

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