Count Records

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi Guys,
How can I count records in a a combobox to allow me to scroll using the
slider bar without first having to scroll to the bottom of the list?

Regards

John
 
Count the records in the rowsource of the combobox:

NumRecord = DCount("*","NameOfTheRowSource")

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Or, simpler and faster (and likely more accurate)

NumRecord = Me!NameOfCombobox.ListCount
 
HI Guys
Thanks for the replies.
I have put this code in the onclick event of the combobox but it does not
seem to work.
I am using access 2007, would this make a difference?

Regards

John
 
What does "does not seem to work" mean? Are you getting an error message? If
so, what's the error? If you're not getting an error message, what are you
getting (and what do you expect to be getting)?
 
Thanks for the Reply Douglas,
Sorry for being vague.

There are no error messages, I have changed the code to use the name of my
combobox.
If I drag the slder bar nothing happens, if I scroll to the last record I
can then use the slider bar to move up and down.
I want to be able to scroll through the combobox list without going to the
last record.

Reagrds

John
 
To what slider bar are you referring? If you can't drag the slider bar, how
do you get to the last record?
 
Douglas,
I can select and drag the slider bar but the records do not scroll at all.
If i click the sliderbar up and down arrows then i can scroll but i need to
scroll faster.

If i select the sliderbar marker and drag downwards the records do not
scroll.
When I stop scrolling with the sliderbar and release the left mouse button,
a record is selected depending on how far doen i have scrolled. this is not
what i am looking for.

I have seen this done in other databases where the sliderbar can be selected
and dragged up or down and the records scroll in synchronisation.

Regards

John
 
I'm very confused. It sounds as though you're talking about the scroll bar
for the form itself. What does that have to do with knowing how many records
exist in the combo box?
 
Douglas,
I cannot make this any more clear than I already have.

When you have a combobox which has its listrows set to 20 and there are more
than 20 records a scroll bar appears to be able to view further than the 20
records shown.

I want to be able to drag "the box on the scroll bar" in the combobox and
scroll through records, without first having to goto the bottom of the list
(Counting the Records)

If you are confused, imagine my Dilemma.

Regards

John
 
John is right. I never noticed this peculiarity before. If you have a
combobox that displays say, 20 rows and the total number of rows is in the
hundreds, you can't get to the bottom of the list easily. If you drag the
scroll button to the bottom, when you release the mouse button, the button
jumps up and you don't get the bottom of the list. You may have to drag the
button to the bottom a dozen times or more to finally get it down there
where the 'zzzz's are. Clicking or Shift-Clicking the bottom of the scroll
column does no better.
A workaround is to type an 'x' or a 'z' and then click the combobox drop
down. The list will start with the first row matching 'x' or 'z'. Maybe
this is what I do intuitively, so I never noticed the behavior above.

UpRider
 
John said:
When you have a combobox which has its listrows set to 20 and there are more
than 20 records a scroll bar appears to be able to view further than the 20
records shown.

I want to be able to drag "the box on the scroll bar" in the combobox and
scroll through records, without first having to goto the bottom of the list
(Counting the Records)


Kahuna had this same question just yesterday. Try using a
line of code in the form's Load event:

x = combobox.ListCount
 
Thanks Marshall
I though I was going mad.

That worked a treat.

Thanks for all your help Douglas, sorry for causing any headaches.

Kind Regards

John
 
Back
Top