Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-29-2019, 10:00 PM   #1
atzdgreat
Newly Registered User
 
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
atzdgreat is on a distinguished road
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

atzdgreat is offline   Reply With Quote
Old 10-30-2019, 12:01 AM   #2
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,569
Thanks: 68
Thanked 2,745 Times in 2,630 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: How to catch keyreturn in Listview

maybe use Keypress event.
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 10-30-2019, 12:35 AM   #3
atzdgreat
Newly Registered User
 
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
atzdgreat is on a distinguished road
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

atzdgreat is offline   Reply With Quote
Old 10-30-2019, 01:46 AM   #4
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
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.
isladogs is offline   Reply With Quote
Old 10-30-2019, 04:34 PM   #5
atzdgreat
Newly Registered User
 
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
atzdgreat is on a distinguished road
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.
atzdgreat is offline   Reply With Quote
Old 10-30-2019, 04:47 PM   #6
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
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)
isladogs is offline   Reply With Quote
Old 10-30-2019, 05:03 PM   #7
atzdgreat
Newly Registered User
 
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
atzdgreat is on a distinguished road
Re: How to catch keyreturn in Listview

yes since i am at is with listview than listbox.. but do you think windows 32 it will?

atzdgreat is offline   Reply With Quote
Old 10-30-2019, 05:05 PM   #8
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,233
Thanks: 115
Thanked 3,072 Times in 2,790 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
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)
isladogs is offline   Reply With Quote
Old 10-30-2019, 05:06 PM   #9
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,888
Thanks: 38
Thanked 571 Times in 538 Posts
MajP has a spectacular aura about MajP has a spectacular aura about
Re: How to catch keyreturn in Listview

I tried it in listview and got the same results. Return not captured.
MajP is online now   Reply With Quote
Old 10-30-2019, 05:22 PM   #10
atzdgreat
Newly Registered User
 
Join Date: Sep 2019
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
atzdgreat is on a distinguished road
Re: How to catch keyreturn in Listview

Quote:
Originally Posted by isladogs View Post
Sorry but I don't understand what you are asking.
because next year we're planning to migrate in windows 10 32bit

atzdgreat is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

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.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World