On Key Press Event (1 Viewer)

Allan.Day

Registered User.
Local time
Today, 13:26
Joined
May 18, 2013
Messages
25
Dear All

I have 2 form, form1 and form 2 (picture attached)

In Form 1 (main form) there are "reference" field with key pressed event
then call form 2 (list of reference that user can choose)

In form 2
the problem is, when "enter" key pressed (keypress event), selection will move to next record
so the data that transferred to form 1 is wrong (next record)

the question is : how to save current record in form 2 before enter and send the data to form 1


thank you and iam sorry for my bad English

allan
 

Attachments

  • Form 1.jpg
    Form 1.jpg
    56.2 KB · Views: 111
  • Form 2.jpg
    Form 2.jpg
    31.6 KB · Views: 100

David R

I know a few things...
Local time
Today, 01:26
Joined
Oct 23, 2001
Messages
2,633
I'm not entirely clear from your screenshots what field is being used to trigger the Keypress event - however it doesn't really matter.

I think you'll be MUCH better off making that field a combobox rather than a separate popup form. It will do all of the fiddling and data entry for you. Just make sure the combo is BOUND to the field you want to store the data in, but that its Row Source is to the table/query you want to pick from.
 

Allan.Day

Registered User.
Local time
Today, 13:26
Joined
May 18, 2013
Messages
25
I'm not entirely clear from your screenshots what field is being used to trigger the Keypress event - however it doesn't really matter.

I think you'll be MUCH better off making that field a combobox rather than a separate popup form. It will do all of the fiddling and data entry for you. Just make sure the combo is BOUND to the field you want to store the data in, but that its Row Source is to the table/query you want to pick from.

Thanks David

the field is being used to trigger the key press event is "reference"
when "S" key pressed, this triggered form 2 to pop up, and show list of reference that user can choose, why I don't use combo box, with this way, user doesn't need use mouse, and when list double click, it will show history of their transaction, easy to trace

may I focus to main problem :

on key press "enter" we need to capture "reference number" in reference field and send it to another form, but the problem is, when we press enter, the data will move 1 step, so it is not exactly what we need, we need back 1 record

I believe there are any different better way, but my short knowledge may be the problem


thanks for help
 

David R

I know a few things...
Local time
Today, 01:26
Joined
Oct 23, 2001
Messages
2,633
Comboboxes can also use the keyboard. You may need/want to move the combo earlier on the form so there is something after it, or change the cycle property of the form so it doesn't jump to the next entry though that doesn't mesh with your desire to use keyboard-only input. But then you say you want to be able to double-click...

Why does the data go and get stored on another form? If that's truly necessary you can open a recordset to the underlying table of that form and update it directly, but I am leery of teaching you how to perpetuate a bad design... maybe we need more information on what you are trying to do here. Reference should probably be a transaction number or something, not a monetary amount. Maybe have them hit enter on the left column instead of the right?
 

Users who are viewing this thread

Top Bottom