selected row count of list box

A2k

Is there a way to get the selected row count of a list box dynamically as
the user selects rows? Delphi has an event called "OnSelectionChanged" but
Access is much more limited. I don't want the user to have to exit the list
box or click a button or anything manual in order to see the # of rows he's
selected. How can this be done?

I know about "lstCusts.ItemsSelected.Count" but not sure what event to use
it in to accomplish what I need.

Thanks,

Keith


0
Keith
10/11/2007 3:25:31 PM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
1632 Views

Similar Articles

[PageSpeed] 44

Never mind. I did this and it handles both mouse and keyboard selections:

Private Sub lstCusts_AfterUpdate()
    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_Click()
    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub

Private Sub lstCusts_KeyUp(KeyCode As Integer, Shift As Integer)
    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
End Sub



"Keith G Hicks" <krh@comcast.net> wrote in message
news:OeMy5rBDIHA.4712@TK2MSFTNGP04.phx.gbl...
> A2k
>
> Is there a way to get the selected row count of a list box dynamically as
> the user selects rows? Delphi has an event called "OnSelectionChanged" but
> Access is much more limited. I don't want the user to have to exit the
list
> box or click a button or anything manual in order to see the # of rows
he's
> selected. How can this be done?
>
> I know about "lstCusts.ItemsSelected.Count" but not sure what event to use
> it in to accomplish what I need.
>
> Thanks,
>
> Keith
>
>


0
Keith
10/11/2007 3:33:10 PM
"Keith G Hicks" <krh@comcast.net> wrote in message 
news:OeMy5rBDIHA.4712@TK2MSFTNGP04.phx.gbl...
> A2k
>
> Is there a way to get the selected row count of a list box dynamically as
> the user selects rows? Delphi has an event called "OnSelectionChanged" but
> Access is much more limited. I don't want the user to have to exit the 
> list
> box or click a button or anything manual in order to see the # of rows 
> he's
> selected. How can this be done?
>
> I know about "lstCusts.ItemsSelected.Count" but not sure what event to use
> it in to accomplish what I need.

Use the listbox's OnClick event.



0
Stuart
10/11/2007 3:38:20 PM
"Keith G Hicks" <krh@comcast.net> wrote in message 
news:ugy8JwBDIHA.5752@TK2MSFTNGP02.phx.gbl...
> Never mind. I did this and it handles both mouse and keyboard selections:
>
> Private Sub lstCusts_AfterUpdate()
>    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
> End Sub
>
> Private Sub lstCusts_Click()
>    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
> End Sub
>
> Private Sub lstCusts_KeyUp(KeyCode As Integer, Shift As Integer)
>    Me.txtSelRowCount = lstCusts.ItemsSelected.Count
> End Sub
>
>
>
> "Keith G Hicks" <krh@comcast.net> wrote in message
> news:OeMy5rBDIHA.4712@TK2MSFTNGP04.phx.gbl...
>> A2k
>>
>> Is there a way to get the selected row count of a list box dynamically as
>> the user selects rows? Delphi has an event called "OnSelectionChanged" 
>> but
>> Access is much more limited. I don't want the user to have to exit the
> list
>> box or click a button or anything manual in order to see the # of rows
> he's
>> selected. How can this be done?
>>
>> I know about "lstCusts.ItemsSelected.Count" but not sure what event to 
>> use
>> it in to accomplish what I need.
>>
>> Thanks,
>>
>> Keith

You really only need the click event. It responds to both kbd & mouse.



0
Stuart
10/11/2007 3:57:14 PM
Reply:

Similar Artilces:

fonts in drop down boxes
Is it possible to change the font or the colour of a font in a drop down box? Thanks. ...

Create Combo Box to Find a Record
I would like to create a combo box based on two fields on my form that will list each [CertificateNo] that is marked [Registered (Yes)]. Registered column is Yes/No. I made a query but the wizard will not let me find the record based on the query. I tried changing the Row Source in Properties to my query named [Registered Certificates] but, alas no luck. Is there anyone who can help me with this problem? Much appreciated. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1 Hi Uschi, in the header of almost e...

Filtering or Formatting DataValidation List
In ColumnG I have the following formula array from row2 all the way down to row100 =IF(ROW(FilteredMonday)-ROW(E2)+1>COUNT(F2:F100),"", INDEX(E:E,SMALL(F2:F100,ROW(INDIRECT("1:"&ROWS(FilteredMonday)))))) ColE = FilteredMonday (a list of my employees who work on Mondays) ColF = counter In ColumnM I have a drop down list with data validation and the source for it is ColumnG. The problem is I only have 43 names but I wanted it to have the capacity for 100 names, so rows 44-100 are either a 0 or #NUM!. How can I have the drop down list show only th...

how to add an outlook email to a text box in an access form?
Hi, I searched everywhere for a similar issue but in vain... I have a form used to enter computer issues. I would like to add to it a text box that will store emails. It could be a button that opens a link to the email. I hope this is clear. thanks. Ismail -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1 Hello, Could you save the emails in a folder and place a button on your form that is hyperlinked to the folder? Might be an easier way but this is pretty simple. "ielmrani via AccessMonster.com" wrote: > ...

Counting 12-28-07
I have a data element in a table named Results. This is defined as a number field. The Values go from 0 to 11. The problem is I need to count a certain value but sometimes that value has not been chosen and that, of course, returns nothing. I would like it to return the result value I am looking for and a '0'. Any ideas? Post your SQL. -- KARL DEWEY Build a little - Test a little "Bunky" wrote: > I have a data element in a table named Results. This is defined as a number > field. The Values go from 0 to 11. > The problem is I need to count a certai...

VBA: Insert rows
Hi, I am using the following VBA code to insert a number of rows starting from the value contained in cells(5,3) and ends before or on cells(10,3) the values are always in ascending order and in series. like 12, 13,1 4 etc. I am getting a type mismatch error in the last line of code. It will be great if someone can help me out with this. Sub main() Dim i As Integer Dim value1 As Integer Dim value2 As Integer value1 = Cells(5, 3).Value For i = 1 To 5 If Cells(5 + i, 3) <> "" Then value2 = Cells(5 + i, 3).Value 'MsgBox v...

Make "Header row" default search mode?
I have a very simple worksheet I use as a task manager. One of the columns contains values from 1 - 5 representing the urgency of the tasks. I'm constantly adding and deleting tasks, and changing the urgency values for tasks as my situation changes. Which means that I'm constantly re-sorting the data so that the most urgent tasks appear at the top of the sheet. Somehow I've managed to set the spreadsheet so the Sort command thinks that I have no header row. So each time I sort I have to manually check the "Header row" button under "My list has." Isn't ...

delete rows which have a one in them
i've got this code built that will delete a row if there is a one in column h but it's not working sub delete() finalrow = celss(rows.count, 1).end(xlup).row for i = finalrow to 2 step -1 if cells(i, 8) = 1 then cells(i, 1).entirerow.delete endif next i end sub it doesn't work, what do you think is wrong? Try this. Sub Macro1() ' count down through the rows(from bottom to the top) For MyRow = Worksheets("Sheet1").UsedRange.Rows.Count To 2 Step -1 ' check column H for a "1" If Worksheets...

Row height #3
Does anyone know why a cell will not increase in height when it's formatted "autofit", with wrap text? Connie, does the row have merged cells? I think this is a problem in excel -- Paul B Always backup your data before trying something new Using Excel 97 & 2000 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Connie" <anonymous@discussions.microsoft.com> wrote in message news:00fa01c3b447$ff88a9d0$a401280a@phx.gbl... > Does anyone know why a cell will not increase in heig...

Take Rows from Sheet1 and use as headers on Sheet2
I have 10 rows on sheet 1 that users fill in. I'd like those 10 rows to be the top lines printed on all subsequent sheets. Is this possible? How? Thanks in advance. Does "Sheets" mean pieces of paper -- when you print one worksheet, you can have multiple sheets of paper printed? If yes, then File|page setup|sheet tab|rows to repeat at top. If you mean you want worksheet 2 to use worksheet 1's headers, I think you'll want to put those headers in each worksheet. Keith Marbach wrote: > > I have 10 rows on sheet 1 that users fill in. I'd like those 10 ro...

loading a count of another entity into a field on the primary entity
Hi I have a custom entity associated with Opportunities called Required Conditions. From the Opportunity enity I need to be able to check the count of the Required Conditions in order to disallow/allow certain actions. The simplest way of doing this (from what I can see) would be to populate a field on Opportunity with the count of the Required Conditions when the Opporutnity is loaded, however I have no idea how to do this. Can anyone out there assist? TIA Saira You may want to consider a callout (3.0)/plug-in (4.0) instead. Whenever one of your custom entities is created, updated...

List Price Issue
Hi All, I use CreateSalesOrder() of web services to create a Sale Order, however, when I set a list price = $60.00 of an item A for example, instead of $50.00 of item A that already existed in Inventory last month. The reason I do because I want to keep 50.00 of Item A and change $60.00 for a perticular Sales Order but not all. So, when CreateSalesOrder() is created, the List Price always take $50.00 of Item A inventory, doesn't matter you change to $60.00. I think the problem is Create Policy but I don't how to use or set it. Please advice. Thanks, -Toi Look at how a s...

find rows for unique data in 1 column and different data in other.
I have a spreadsheet that contains 1 column that contains cells that may contain the same information such as A2 and A4 and A6 all contain 4144638872 - in columns B-P there may be information that may be different for each 1234 cell: A2=4144638872 B2=278954 A4=4144638872 B4=195871 A6=4144638872 B6=238521 I want to return a result of unique rows based on only 1 phone # that exists in column A. I need the information in column B and other columns and I don't care which of the 3 remain in the result sheet. Basically I have a list of file#s with the same phone #s and I only want ...

Handling very large files (too many rows)
I'm trying to analyse a set of data. However, the data is a CSV fil with almost 1.5 million rows, which somewhat excedes the 65 thousand o so that excel can handle. However, excel is what I'm used to. If ther any convenient way to import so much data? Alternately, can anyon recomend a different means to observe and process that amount of data -- Message posted from http://www.ExcelForum.com I really think that is way too much for Excel, even if you break it into bits. What you should use depends on how you want to analyse the data. Access can handle that quantity of data. Maybe, if...

how to count populated rows?
How do I find out how many rows have data in them starting with row 4 and beyond? It's ok if I just know that column A has data in it. I'm using VBA. I don't know how to use functions very well. But I know visual basic some. So if you could give me some VBA code to do this, that would be great. Thanks. Ryan, I was doubtful that just knowing there was data would be enough... So following is some code to cover several possibilities. (you can understand how some of this works if you look up the terms used in the help file - just stick the cursor in a word and press F1) '---...

White List
How do I create a white list (do not filter) including people who are not in my global lists? Even the smallest list in Outlook 2000 doesn't fit on the exchange server if I try to set it to Stop Processing in the Rules Wizard. Even if it only happened after it went through the server it would be better than nothing. You can whitelist by defining a rule, like: Apply this rule after a message arrives sender is in <contacts> Address Book and on this machine only stop processing more rules <duplicate of above rule for each contact-type folder> Apply...

How to make a chart with selective (discontinuous) data?
For example, two colums A and B have 10 rows (2 to 11) with values in each cell. How can I make a graph A Vs B which displays data only from rows 2, 5 8 and 10. I mean from discontinuous data and not from a continuous range. If yes how to do in very large sheet? Best to use your worksheet to pull the data into a continuous range, and then plot that. -- David Biddulph "Making grapg from discontinuous data" <Making grapg from discontinuous data@discussions.microsoft.com> wrote in message news:6E74492E-4B84-41B1-B50A-C322A703370E@microsoft.com... > For example, two colu...

range select a value in a cell?
I have formulas calculating values to produce cell references such as J10, L15 etc the formulas are similar to ="I"&TEXT(Q4, "d") I am creating a macro where I want to select the cells calculated from my formulas... instead of using range("J10:K10").select i want the range to use the specific cell reference calculated in my formula... because the range i want to select changes every time a new record is added. is there a way to do this? any help is much appreciated. thanks b2: a2:a4 c2: =SUM(INDIRECT(B2)) --- HTH, David McRitchie, Microsoft MVP -...

Outlook 2007 Distribution List
I'm trying to print my Distribution List on one page. Outook 2007 prints the header info on one page and the members on another page. I want to print it all on one page like I did with Outlook 2003. You can save it as a .txt file and then print that file. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "MStone" wrote: > I'm trying to print my Distribution List on one page. Outook 2007 prints the > header info on on...

Having issues handling combo-box
I have a combo-box. I want to allow folks to enter by typing OR use the mouse to click on the dropdown. If they type I want it to auto-complete - that is no problem as the drop list style handles this. Where my problem arises is that when they pick the one they want I then need to know so I can do some added processing. I could handle the kill focus for when they type but that causes confusion when they use the mouse. What I want to be able to do is recognize when they hit <Enter> and act in a manner similar to that used when they use the mouse to pick an entry. The other possibili...

Stopping VBA code when it hits the last row
I have a list of data the is in 4 columns, and the number of rows will vary from week to week.. Columns A-C are filled with data, and Column D will only have data in certain cells (ie, row 6 could have a value and then the next row to have a value could be row 20...and this value may or may not be different than the value in row 6). I am trying to wrote code that will fill in the blanks in column D, so it would copy the value in row 6 to all blank cells below it until is finds another value (7-19 in my example). Then it will find the next value and copy that to all blank rows below i...

On Send/Receive: Dialog box "The operation failed. Object not fo
Outlook 2007. When I click on send/receive, I get a dialog box that reads "The operation failed. An object could not be found". Initial set-up was successful because Outlook bounced a confirmation message to my ISP and it came back properly. I can use e-mail through Explorer and my ISP, but not through Outlook. This is a problem with a new Gateway GM5420 computer, new Microsoft Vista, and a new installation of Microsoft Office Professional 2007. See if this helps: http://support.microsoft.com/kb/312354/en-us You receive the "The operation failed. An object could no...

Message box
i would like to place a simple yes no msg box, have tried the code i thought worked, but not having much success, simply want a yes no button with message, Yes msg box closes, no file saves and closes. Any help?????? Hi Kikk ka Try this: sub askmsg() if msgbox("Some message", vbYesNo)=vbNo then activeworkbook.close true end if end sub -- Hope this helps Martin Fishlock, Bangkok, Thailand Please do not forget to rate this reply. "K1KKKA" wrote: > i would like to place a simple yes no msg box, have tried the code i > thought worked, but not having much suc...

Edit box, ::TextOutW(), and repainting
I have a dialog-based app with an edit box. I also have a CEdit class used to manage the edit box. For various reasons I HAVE to use ::TextOutW() to write information to the edit box because I'm displaying Unicode codes. Everything works fine except when the app is covered and then brought to the foreground again the data in the edit box is not repainted. I've tried to repaint the data in the dialog's OnPaint() message but that didn't work. As a test, and to get me by, I set a short timer in OnPaint() and then rewrote the edit box data in the OnTimer() message. I know! I ...

how do I assign a variable to a check box or radio control?
I need to assign the value of a radio control or check box when clicked on to a variable, preferably using the SetTemVar macro. Use the AfterUpdate of the control (if it's a stand-alone control), or of the option group (if it's part of an option group) to SetValue (in a macro) or assign the value (in code.) Not sure if it's really a good idea though. Considerations such as: - You can quite easily read the value from the form. - Doesn't work in versions of Access before 2007. - If it's a bound form, the tempvar would not be up to date when you move to a different recor...