S
Santa-D
I'm hoping someone can help.
I have a form with all the information related to leasing a motor
vehicle, in this form I have a subform which allows the user to make
comments which automatically inserts the date.
When dealing with vehicle acquisitions I've made a pop-up form which
comes up when the user hits the F4 key.
The form that comes up is "Common Messages" which includes a subform
with various comments i.e. VAA - Received from Supplier | VAA - Sent to
Region.
What I want to do is when the user presses the escape key, the form
closes and doesn't return a value (Which isn't working) and when they
press the enter key on a selected comment it returns the value to the
form. I just tried to use a macro that I'm using when you double click
on the record you want to insert into the comments form but it's on
every key press not just "Enter"
This is what I have so far.
<b>COMMENTS FORM</b>
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF4 Then
DoCmd.OpenForm ("frm-defaultmessages")
End If
End Sub
This works well. The defaultmessages form opens up showing a
subform-datasheet with various messages that can be entered or you can
type in a new one. Once the required value is selected I want to be
able to press the enter key and return the message selected to the Main
form.
The macro that I'm using when I double click on the record is simply
this.
<b>Set Value</>
- Item: [Forms]![qry-vehicle-search mainform]![db-vehicle-comments
subform].[Form]![Comments]
- Expression:
[Forms]![frm-defaultmessages]![tbl-common-messages_subform].[Form]![Message]
<b>Close</b>
What do I need to do to have the Enter key to return the value?
Would it be something like - vbKeyExecute?
I have a form with all the information related to leasing a motor
vehicle, in this form I have a subform which allows the user to make
comments which automatically inserts the date.
When dealing with vehicle acquisitions I've made a pop-up form which
comes up when the user hits the F4 key.
The form that comes up is "Common Messages" which includes a subform
with various comments i.e. VAA - Received from Supplier | VAA - Sent to
Region.
What I want to do is when the user presses the escape key, the form
closes and doesn't return a value (Which isn't working) and when they
press the enter key on a selected comment it returns the value to the
form. I just tried to use a macro that I'm using when you double click
on the record you want to insert into the comments form but it's on
every key press not just "Enter"
This is what I have so far.
<b>COMMENTS FORM</b>
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF4 Then
DoCmd.OpenForm ("frm-defaultmessages")
End If
End Sub
This works well. The defaultmessages form opens up showing a
subform-datasheet with various messages that can be entered or you can
type in a new one. Once the required value is selected I want to be
able to press the enter key and return the message selected to the Main
form.
The macro that I'm using when I double click on the record is simply
this.
<b>Set Value</>
- Item: [Forms]![qry-vehicle-search mainform]![db-vehicle-comments
subform].[Form]![Comments]
- Expression:
[Forms]![frm-defaultmessages]![tbl-common-messages_subform].[Form]![Message]
<b>Close</b>
What do I need to do to have the Enter key to return the value?
Would it be something like - vbKeyExecute?