473,748 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListBox Row Click Event

14 New Member
Hi all

Is there any event for list box row click/double click.I want to open a new form based on the row selected and when it is clicked.I know there's one for the whole list box but i am looking for a row click event.I want to know if there is such an event or any other way to implement this.


thanks
Sree
Jan 20 '09 #1
10 6794
DonRayner
489 Recognized Expert Contributor
Hi Sree, How about using the after update event to trigger opening the form.
Jan 20 '09 #2
Megalog
378 Recognized Expert Contributor
There is no row specific event. Basically you need to code whatever routine you need, to look at the selected row(s) and perform whatever function it is you're trying to do. Check out the help file on the listbox's 'Selected', 'ListCount', and 'Column' properties. Using those you should be able to come up with a nice loop that runs through your listbox's rows and performs whatever function you need on the selected row's data.

If you need anything more specific, then please post whatever it is you're specifically trying to do, with example data. I know you said you're trying to open forms, but based on what?

-Mega
Jan 20 '09 #3
buddydasari
14 New Member
don

thanks for the help.i'll try that.

Megalog

i am populating employee info in the list box and each record refers to one employee.What i am trying to do is open the selected employee details page/form when i click on the particular record/row.I have Employee Last Name ,First Name ,UserName(prima rykey),Email in the listbox.I want the specific form to be opened on some double click event rather than a single click.

hope this helps
Sree
Jan 20 '09 #4
Megalog
378 Recognized Expert Contributor
"UserName" is the primary key for the employee table? This isnt a text value is it? You do have a normal numeric unique PK in that table as well, I hope? I've seen where people use the full name in the contacts/employee table as the PK, and it can get ugly once you get two employees named John Smith, etc.

Also, what is the name of the form you want opened?
Jan 20 '09 #5
buddydasari
14 New Member
Megalog

Yes UserName is the primary key.Its the same as the email id without the domain name so its always unique(somethin g like for outlook exchange).

thanks
Sree
Jan 20 '09 #6
Megalog
378 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. Dim varRow
  2. Dim varID
  3. varRow = Me.List0.ListIndex + 1
  4. varID = Me.List0.Column(2, varRow)
  5.  
  6. 'Use this if UserName is a numeric value
  7. DoCmd.OpenForm "Contact Details", , , "[UserName]=" & varID
  8.  
  9. 'Use this if UserName is a text value
  10. DoCmd.OpenForm "Contact Details", , , "[UserName]='" & varID & "'"
Replace "List0" with your listbox name. From what you said before, I'm assuming UserName is the 3rd column in your listbox. If it isnt (if you have hidden values, etc) then adjust the VarID above so that the number is whichever column it's in, minus 1. (first column starts at zero).

You didnt state what the name of the form you're opening was, so replace my "Contact Details" with the formal form name.. and you should be set. Also, Comment out or delete whichever DoCmd.OpenForm line doesnt apply (depending on whether UserName is numeric or text).
Place all that code in the doubleclick event on the listbox and give it a shot.


-Mega
Jan 20 '09 #7
buddydasari
14 New Member
I laid out a basic prototype and it seems to work on the double click event but i still have to do some more background work to populate the form details which i can do.

thanks for your help
Sree
Jan 20 '09 #8
buddydasari
14 New Member
Megalog

I tried to use the command

DoCmd.OpenForm "Individual_Inf o", , , "[UserName]='" & rs!UserName & "'"

and i get this error on double click

"run time error 2491 :the action or method is invalid because form is not bound to table/query"

any idea what i am doing wrong??

thanks
Sree
Jan 21 '09 #9
Megalog
378 Recognized Expert Contributor
Well it seems the error message is going to ask the same thing I'm going to ask... is the form bound to a table or query? Go to it's recordsource property and see if a table/query name, or a select statement is there. And if there is, make sure 'Username' is a valid field within that source.

If you open the form manually, are you able to cycle through all the existing user records? If so, then it's bound to that data.

If not, then what exactly is the intended function of this form? I assumed it was bound to a user table, that you wanted to pop open to see all the user's full details from a list box. The better you explain things, the better I can help. =)
Jan 21 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1431
by: CoreyMas | last post by:
Hello everyone Is there a way to create a double click event on a listbox control in VB.net without having to resort to Javascript? Thanks in advance Corey
1
1305
by: Daniel G | last post by:
Hello , In an ASP.Net page, there are some DropDownLists used for adding some conditions to a Select statement, a button (server-side, too). And in the same page there is a ListBox that must be filled by Click event handler of my button. Everything is ok, but ... it is something very strange with the ListBox (autopostback = true)
5
1853
by: PAPutzback | last post by:
Form2 has one purpose to open and list some names and ids. I want to handle the list box click event on form2 so I can get the selected value onto a field in form1. I changed this Dim MyForm2 As New PHfx.Form2 to With Events MyForm2 As New PHfx.Form2 and tried adding an event handler but intellisense will not show form2s objects, just the methods.
1
1886
by: tony | last post by:
Hello! If you drag a ListBox into a windowform and then right click on this ListBox and then chose property. When you have the properties up click on the flash symbol for seeing all the events for this ListBox. The property page where you can see all the events I call property event page.
1
7064
by: superjacent | last post by:
Hope someone can point me in the right direction. When opening a form the 'click' event of the ListBox is invoked (run). I thought the 'click' event of the ListBox is only invoked when clicking it. I've looked all over the preceeding and other events on the form and definitely do not invoke the ListBox 'Click' event. What does happen during form initialisation or setup (load) is that the rowsource, columnwidths, columncount etc are...
4
4755
by: Jeff User | last post by:
Hi Using .NET 1.1, C#, web app I (actually our client) would like to be able to double click a selection in a listbox and have it postback to server . There I would want to access the item that was double clicked. Any idea how to go about this? Thanks
5
23903
by: buddydasari | last post by:
Hi all I wrote a listbox onclick event.On a click i want to get the selected row details but the listbox.selected(i) always returns false ,it returns true only in double click event.Are they any other events on which i could do this.I want to populate a textbox based on the row selected from the listbox.Its working as i want when i add the code in a double click event but it doesn't make much sense doing it on a double click event. ...
7
4311
by: onyris | last post by:
Hi guys, have a form which displays all the records i have in my database , and a search box for the user to search for a specific one . On the search button, i run a macro which opens another form with only the records found based on the search. So far so good On the second form, first record found is displayed ( customer and deatils) and u can navigate through the rest . But i also have a listbox which holds only a field ( first_name...
2
7715
by: svibuk | last post by:
i have a asp.net list box populated with databae data , autopostback = true wht i need is 1) when double clicked(double click event) i want it to be visible=false 2)i want to move between the data in the listbox using up, down arrow keys & make the selection by pressing eneter(keypress event) 3) everytime i move betwen the data(autopostback = true) postback is caused,is it possible to avoid the flickering without ajax as if i have to...
0
8995
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.