473,394 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to select a record from a list box?

Hi,

This is what I have.
I have 2 forms called (1) "LessonOutcomeAdd" and
(2) "LessonOutcomes". (2) is a list box with showing all the Records in (1).
The identifier in (1) is "ID"
What I want to do is the following.

If there is a record that I want to edit I will open form (1). It has a search button that opens form (2) showing all the records. When I double click on a record in (2) then it must go to that specific selected record in (1) and then allow me to edit that record.
If you can help me on this it would be very appreciated.

Thank you!
Nov 21 '10 #1
2 1602
ADezii
8,834 Expert 8TB
The following Code, in the Dbl-Click() Event of the LessonOutcome List Box, should do the trick. Just remember 2 things:
  1. Form LessonOutcomeAdd must be Open.
  2. LessonOutcomeAdd will now be Filtered, and displays only a single Record for editing.
Expand|Select|Wrap|Line Numbers
  1. Private Sub LessonOutcomes_DblClick(Cancel As Integer)
  2. Dim lngID As Long
  3. Dim frm As Form
  4.  
  5. 'Assumes that [ID] is the Bound Column for LessonOutComes
  6. lngID = Me![LessonOutcomes]
  7.  
  8. Set frm = Forms![LessonOutcomeAdd]
  9.  
  10. With frm
  11.   'Set Focus to the Calling Form (LessonOutcomeAdd)
  12.   frm.SetFocus
  13.  
  14.   'Set the correct Filter for the LessonOutcomeAdd Form & turn it on
  15.   frm.Filter = "[ID] = " & lngID
  16.   frm.FilterOn = True
  17. End With
  18.  
  19. 'Close the LessonOutcome Form
  20. DoCmd.Close acForm, "LessonOutcome", acSaveNo       'Criteria Form only
  21. End Sub
Nov 21 '10 #2
Great!!!!!!!! It's working perfectly.
Nov 21 '10 #3

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

Similar topics

4
by: Eric Freeman | last post by:
Is there any way in Postgres to SELECT a list of table names from inside of a C program using ECPG? Something similar to SELECT current_user that will give you all of the tables in the database...
4
by: VK | last post by:
I'm looking for autoexpand <select> list onfocus and collapse it back onselect/onblur (the list is select-one type) I know it is not possible directly, but I've seen here a hack by changing...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
3
by: Beholder | last post by:
I hope that someone can help me with the following: Short background explenation: I have a shrfepoint page (newform.aspx) in a item list. On this page is a lookup column that displays a lookup...
5
by: =?Utf-8?B?bWNhdWxpZmZl?= | last post by:
I have an old application ( pre-VB5) that I need to add a select/option list to. This is an edit program so the values for the form will be retrieved from a database. How do I set the value of...
3
by: reverendjb | last post by:
I'm stumped on this one, so here goes.... I have 2 tables project and assignment they are linked by the field proj_id where proj_id is the primary key of project and a foreign key in...
2
by: Shivajirp | last post by:
I have table in which Shift no, Start time. End time. if start time of shift is 6pm and end time of shift is 6 am then I want to select record between start time and end time.I need query to selct...
0
by: Andrus | last post by:
How to create select columns list dynamically in DLinq ? I want to create something like Console.WriteLine("Enter list of columns to return, separated by commas:"); string list =...
1
by: rk2008 | last post by:
Hi, I'm using following code to select a record on a form from dropdown list and I'm using MSSQL ODBC linked tables inside MS Access: Private Sub cboFind_AfterUpdate() Dim strCriteria As String...
8
by: simonc88 | last post by:
Hi guys hope you can help with this one, I have a list box being fed by a table, the list box has 3 columns with the first being an ID number and displays the records that are saved in the table....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.