Double Click record in listbox and have that record pop in other f

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I have a list box that is populated by a query. I would like to use the
double click event to open that specific record in another form. Please help
me to understand how I can do this. Thank you.

B
 
Bstice said:
Hello:

I have a list box that is populated by a query. I would like to use the
double click event to open that specific record in another form. Please help
me to understand how I can do this. Thank you.

The code in your double-click event would be similar to...

DoCmd.OpenForm "FormName",,,"SomeField = " & Me!ListBoxName

The above would be for numeric field matching. For Text you would need quotes
around the value...

DoCmd.OpenForm "FormName",,,"SomeField = '" & Me!ListBoxName & "'"

The command button wizard would actually write this code for you and then you
could move it to the double-click event of your ListBox.
 
Thanks for your quick reply.

When I plug in this code I get the following error

Run-time error '2501':

The Openform action was canceled.

You used a method of docmd object to carry out an action in VB, but then
clicked cancel in a dialog box.

Could you please advise on what I need to do to overcome this error. Thank
you.

B
 
Bstice said:
Thanks for your quick reply.

When I plug in this code I get the following error

Run-time error '2501':

The Openform action was canceled.

You used a method of docmd object to carry out an action in VB, but then
clicked cancel in a dialog box.

Could you please advise on what I need to do to overcome this error. Thank
you.

My code was a generic sample. You did modify it to your circumstances right?
Post the exact code you used.
 

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

Back
Top