List Box and TextField problems

llaman

New Member
Joined
Jul 14, 2004
Messages
37
I have been scanning the documentation but cannot find where it says how to access the currently selected data.

I have a few text fields on a form and a listbox, and when a button is pressed on the form, I want to grab the data from each of them (the currently selected one in the listbox)

I could only find a "finddata(index)" for listboxes, which does not help me if I do not know which one is selected.

As always, thanks in advance
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Because it's brief and others may benefit - I'll throw in an answer anyways.
The best way to do this is to base a form on a recordsource, which gives you the ability to reference the recordsource (a table?) fields by their names.

Me.fieldname1 would be the field value in the currently selected record only.

One trick you can do is put a form into 'Continuous Forms' and then put a button onto it with all the fields listed...then in code behind the click event you put code that references fields like the above...because you're clicking the button associated to a specific record, you automatically get that particular record only.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,250
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top