473,385 Members | 1,829 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,385 software developers and data experts.

Using ListBox To select data

25
I have a List Box on a form and the RowSource SQL is set in VB to display field data from a table.

How do I pass field data from the users selected row?
Feb 20 '08 #1
4 6128
jeffstl
432 Expert 256MB
Pass it how?

You mean have the selected row data be displayed to text boxes on your form?

Pass it to another form? Capture the row data into variables?
Feb 20 '08 #2
mshmyob
904 Expert 512MB
You haven't given much data.

This is the code to grab a single selected item for a ListBox and pass it to another open form.

You change the control names to match yours and the column number you want to pass.

Requirements - Both forms need to be opened.

Note: vSelected is an Integer

Expand|Select|Wrap|Line Numbers
  1. ' store the Index Array number for the List Box selection row
  2. vSelected = Me.lstPickFrom.ListIndex
  3. ' pass the 1st column (0 based) of the list box (lstPickFrom) to another open form
  4. Forms!frmReceive.txtReceive.Value = Me.lstPickFrom.Column(1, vSelected)
  5.  
I have a List Box on a form and the RowSource SQL is set in VB to display field data from a table.

How do I pass field data from the users selected row?
Feb 20 '08 #3
Codebug
25
Ok, figured this one out myself in the end, as always was simple

I just used the value property of the ListBox which is bound to the correct column of the list to return the value the user selected,

ie:


UserSelection = MyListBox.value
Feb 21 '08 #4
in the new form goto textbox properties > data tab
default value = [Forms]![your_form]![your_control]
programatically maybe docmd.open method ,, stlinkcriteria method

depends on what ju do...
Feb 21 '08 #5

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

Similar topics

1
by: Adhiraj | last post by:
Hi, I come from Java background. I waant to know the C# equivalent to JList in Java. I tried using ListBox but cud not work out how to add elements to it. i.e. there is no method like...
5
by: Han Lim | last post by:
Dear All, I have an application written by VB.Net with connect to a Microsoft Access database. One of the forms is to select data using oleAdapter and fill it into a dataset. In the oleAdapter, i...
10
by: bsn | last post by:
Hello NG I want to select data from another DB, and use this data in currentDB. I have this SQL in a VBA procedure: Sql = "SELECT * FROM Firma " It is not working Any suggestions... ...
1
by: intscript | last post by:
Hi everyone Is is possible to retrieve data using multiple select. Here is my SQL code: select sum(nPassengers) Planned, Actual, (sum(Planned) - Actual) Variance from ( select iDeptCode,...
2
by: vanz10 | last post by:
I everyone, i'm a bigenner when talking about php so that is why I'm asking someone who knows the code if how to view the data by using listbox
0
by: crbaker | last post by:
I have installed the Oracle Client on a Windows 2003 Server and have connected to Oracle using ODBC. I have a UDB/DB2 V8.1 database on the Windows 2003 Server and would like to select data from a...
0
by: Lisa Coal | last post by:
I am using the Insert database command several times in a visual basic macro. Every time I use the command in the macro the Select Data Source screen appears even though the source is set in the...
1
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a DataSet with 2 tables. Now I want to select data like a INNER JOIN from these tables. In SQL Syntax I would write: SELECT * FROM table1 t1 INNER JOIN table2 t2 ON t1.f1 =...
5
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a DataSet with 2 tables. Now I want to select data like a INNER JOIN from these tables. In SQL Syntax I would write: SELECT * FROM table1 t1 INNER JOIN table2 t2 ON t1.f1 =...
2
by: alinagoo | last post by:
Hello all I'm working on a database application with MS-Access 2007 and now i have a problem with dynamic report creation process! I need to guess the data type of a ListBox! This my problem. The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...
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,...

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.