10-29-2019, 10:00 PM
|
#1
|
Newly Registered User
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
How to catch keyreturn in Listview
hi may i know why it wont catch the enter key in listview control in access.
Code:
Private Sub lvCMAList_KeyDown(KeyCode As Integer, ByVal Shift As Integer)
Dim DirFile As String
Dim NewCtr As Integer
Dim BOk As Boolean
Dim msg
Dim LV As MSComctlLib.ListView
Set LV = Me.lvCMAList.Object
If KeyCode = vbKeyDown Then
'THIS WORKS
ElseIf KeyCode = vbKeyUp Then
'THIS WORKS
ElseIf KeyCode = vbKeyReturn Then
'THIS DOESNT WORK
End If
Set LV = Nothing
End Sub
|
|
|
10-30-2019, 12:01 AM
|
#2
|
error reading drive A:
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
|
Re: How to catch keyreturn in Listview
maybe use Keypress event.
__________________
"Never stop learning, because life never stops teaching"
|
|
|
10-30-2019, 12:35 AM
|
#3
|
Newly Registered User
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
Re: How to catch keyreturn in Listview
hi sir arnel, thank you for your reply. i tried keypress event but still no luck. i dont know why only vbkeydown=vbkeyreturn or keyascii=13 cannot be catch. the rest keys are fine. i tried changing the option/Client Settings/ Move after enter to Dont move or next field as well
|
|
|
10-30-2019, 01:46 AM
|
#4
|
High Noon Moderator
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
|
Re: How to catch keyreturn in Listview
Just tested and this worked perfectly for me for all the key strokes I tested
Code:
Private Sub Text0_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then 'vbKeyReturn
MsgBox "Return key pressed"
Else
MsgBox "The '" & Chr(KeyAscii) & "' key was pressed"
End If
End Sub
However its a textbox not a listview….
Can you try it in your list view control
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.
Colin (Mendip Data Systems) To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Website links: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
Last edited by isladogs; 10-30-2019 at 02:34 AM.
|
|
|
10-30-2019, 04:34 PM
|
#5
|
Newly Registered User
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
Re: How to catch keyreturn in Listview
yes i tested it in textbox and it works fine. but in listview it doesnt. hmmm maybe because listview is not part of access? unlike in excel? since we need to declare the listview first like...
Code:
Dim LV As MSComctlLib.ListView
im not so sure with this.
|
|
|
10-30-2019, 04:47 PM
|
#6
|
High Noon Moderator
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
|
Re: How to catch keyreturn in Listview
A listview isn't a standard Access control and is I believe not supported in 64-bit Access. I haven't used it for many years.
Is there a particular reason why you need to use that control?
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.
Colin (Mendip Data Systems) To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Website links: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
|
|
|
10-30-2019, 05:03 PM
|
#7
|
Newly Registered User
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
Re: How to catch keyreturn in Listview
|
|
|
10-30-2019, 05:05 PM
|
#8
|
High Noon Moderator
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
|
Re: How to catch keyreturn in Listview
Sorry but I don't understand what you are asking.
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.
Colin (Mendip Data Systems) To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Website links: To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. , To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
|
|
|
10-30-2019, 05:06 PM
|
#9
|
Newly Registered User
Join Date: May 2018
Location: USA baby
Posts: 1,888
Thanks: 38
Thanked 571 Times in 538 Posts
|
Re: How to catch keyreturn in Listview
I tried it in listview and got the same results. Return not captured.
|
|
|
10-30-2019, 05:22 PM
|
#10
|
Newly Registered User
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
Re: How to catch keyreturn in Listview
Quote:
Originally Posted by isladogs
Sorry but I don't understand what you are asking.
|
because next year we're planning to migrate in windows 10 32bit
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
CatCh
|
Catch |
Introduce Yourself |
0 |
02-08-2013 01:42 PM |
Want to catch an optionbuttons value
|
Jack Daniels |
General |
5 |
02-22-2006 03:05 AM |
Catch 22.
|
Fuga |
General |
1 |
11-19-2002 07:49 AM |
Catch 22
|
aziz rasul |
Forms |
6 |
12-18-2000 08:36 AM |
Catch 22
|
aziz rasul |
Modules & VBA |
3 |
12-15-2000 03:13 AM |
All times are GMT -8. The time now is 10:24 AM.
|
|