Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a Form when "Enter" is pressed (Specific Field) on Another Form

Status
Not open for further replies.

MattMeat

Programmer
Nov 6, 2001
38
0
0
US
Hello Everyone,

I have two forms. The first is in datasheet view and has a column entitled WorkOrderNo. When you double click on one of the numbers in this column, the second form opens (form view) to the corresponding record.

My question is:

What code can I use to make the "Enter" key function as the double click is functioning now. So, when someone selects a WorkOrderNo and presses "Enter" (first form), it does exactly what the "Double Click" does (mentioned above).

I hope this is clear enough.

Thanks,
Matt

 
Go to design view of your form.
Right click on the field that you want to make open the second from, and hit properties.
Once that comes up go to events.
Set the "ON ENTER" event to say the same thing as the "ON DOUBLE CLICK" event.
If they say event procedure then click on the "ON DOUBLE CLICK" event and hit the "..." button on the right.
Select everything in between the "private sub" line and "end sub" line the section that your cursor is in.
Then close that window.
Click on the "ON ENTER" line and hit the "..." button.
Paste the information that you just copied.
You should be done. The hardest questions always have the easiest answers.
 
jtmach,

I considered this at first too, but the "On Enter" event happens when the field is entered, not when the enter key is pressed. I need the code to run when the "Enter" key is pressed.

Does anyone know how I can assign this event to the "Enter" key?

Thanks,
matt
 
Sorry, I was not thinking. Try this,
make a key press event. In that event type
"If keyascii = 13 then
"run macro or code from the double click event"
end if"

Don't include the quotes, and change the text in the middle to run your macro or code. 13 is the number for the enter key don't change that.
The hardest questions always have the easiest answers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top