UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Count Records Of The Recordset Of Combobox, Any Version    
 
   
2ME
post Oct 23 2019, 01:28 PM
Post#1



Posts: 683
Joined: 13-May 10
From: Egypt


Hi
I need to Count Records of the row source of a combobox

I have a form that I can select a product and subform for quality tests (combobox)

what I need to do, when i select the product in the main form to count the number of tests in combox

thanks in advance





--------------------

M.E.M
Go to the top of the page
 
arnelgp
post Oct 23 2019, 01:30 PM
Post#2



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


can you use combo.ListCount

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
2ME
post Oct 23 2019, 01:32 PM
Post#3



Posts: 683
Joined: 13-May 10
From: Egypt


how can I use combo.listcount?

--------------------

M.E.M
Go to the top of the page
 
Larry Larsen
post Oct 23 2019, 02:59 PM
Post#4


UA Editor + Utterly Certified
Posts: 24,375
Joined: 26-August 02
From: Melton Mowbray,Leicestershire (U.K)


Hi

In an unbound textbox in the [Control Source] event place:
CODE
=[cmboNameHere].[ListCount]


HTH's
thumbup.gif

--------------------
"Time...We have exactly the same number of hours per day that were given to Helen Keller, Pasteur, Michaelangelo, Mother Teresa, Leonardo da Vinci, Thomas Jefferson, and Albert Einstein"
H. Jackson Brown
Go to the top of the page
 
2ME
post Oct 23 2019, 03:14 PM
Post#5



Posts: 683
Joined: 13-May 10
From: Egypt


arnelgp and Larry Larsen thank you very much for your help, it works great

I have one more question, I need to count the number of records in the subform
I use the following code, I need your help to define which event to put the code as I tried to use the code with afterupdate event and it doesn't update the number of records correctly


With Me.Form.RecordsetClone
.MoveLast
Me.Text21 = .RecordCount
End With

--------------------

M.E.M
Go to the top of the page
 
arnelgp
post Oct 23 2019, 03:19 PM
Post#6



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


maybe on Current Event of the Subform:
CODE
Private Sub Form_Current()
With Me.RecordsetClone
    If Not (.BOF And .EOF) Then
        .MoveLast
        Me.Parent!text21 = .RecordCount
    Else
        Me.Parent!text21 = 0
    End If
End With
End Sub

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
2ME
post Oct 23 2019, 03:53 PM
Post#7



Posts: 683
Joined: 13-May 10
From: Egypt


I ended with this code

CODE
Private Sub Form_Current()
With Me.Form.RecordsetClone
.MoveLast
Me.Parent!Text21 = .RecordCount
End With
End Sub

but it doesn't update the record till I move to the last empty record
and I moved to the main form without moving to the last record it doesn't update the textbox

--------------------

M.E.M
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th November 2019 - 03:30 PM