Running an onclick event

P

Peter Morris

When I display my form a line of code highlights a particular
row in a listbox.

now I want to run the OnClick event, as if I had actually
selected that row manually. What's the code to do this?
 
F

fredg

When I display my form a line of code highlights a particular
row in a listbox.

now I want to run the OnClick event, as if I had actually
selected that row manually. What's the code to do this?

Call ControlName_Click

Change ControlName to whatever the actual name is of the Sub routine.
Where you place this line of code really depends upon what you are
trying to do ... and when.
 
P

Peter Morris

fredg said:
Call ControlName_Click

Change ControlName to whatever the actual name is of the Sub routine.
Where you place this line of code really depends upon what you are
trying to do ... and when.

Yes, I should have said.

I'm displaying Main_Form. When I click on the button cmd_New
I do the following. This is in the cmd_New_click () procedure

1) display Transaction_Form, which contains a listbox
2) highlight a particular row on the listbox

3) then I want to run the listbox_click routine.


so, I want to call the routine from the code on a different form

What's the syntax for specifying the form and routine I want to run?
 
F

fredg

Yes, I should have said.

I'm displaying Main_Form. When I click on the button cmd_New
I do the following. This is in the cmd_New_click () procedure

1) display Transaction_Form, which contains a listbox
2) highlight a particular row on the listbox

3) then I want to run the listbox_click routine.

so, I want to call the routine from the code on a different form

What's the syntax for specifying the form and routine I want to run?

Call Forms("NameOfForm").ListBoxName_Click

Change "NameOfForm" to the actual name of the form that contains the
event.
Change ListBoxName_Click to the actual name of the sub routine.
 

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