?
Solved

record count in subform

Posted on 2003-03-21
10
Medium Priority
?
419 Views
Last Modified: 2008-03-10
I am using the following code to return a record count for a filtered subform.  However, When I get a zero return I get an error.  Can someone help?

If Me!EDITS2SUB.Form.CurrentRecord = "0" Then
  Me!Text59 = 0
Else
  Me!EDITS2SUB.Form.RecordsetClone.MoveLast

  Me!Text59 = Me!EDITS2SUB.Form.RecordsetClone.RecordCount
End If

Ed
WA1ED
0
Comment
Question by:wa1ed
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 1000 total points
ID: 8181041
Ed, I had a look at the db - the subform is set to AllowEdits so the CurrentRecord will give a value of 1 unfortunately.

You could set the subform's AllowEdits and AllowAdditions properties to No, or alternatively, use this:
If Me!EDITS2SUB.Form.NewRecord = True Then

Does that work ?
0
 
LVL 54

Expert Comment

by:nico5038
ID: 8181097
Hmm, I just don't code this as it's already visible right of the recordnavigation buttons.
When filtered the text (filtered) has been added, thus warning you it's not the entire recordset.

Or do you want to get rid of that ?

Nic;o)
0
 
LVL 54

Expert Comment

by:nico5038
ID: 8181122
Hmm, an alternative might be to create a field txtReccount on the main form and add in the subform's OnCurrent event:

Parent.txtReccount = Me.RecordsetClone.RecordCount

Nic;o)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8181134
I use this when I either want to get rid of the navigation buttons (which I usually do) or when I need that text for someone who is, for example, partially sighted and can't see the buttons very well. I don't think (although I could be wrong) there is any way of changing Access' navigation button sizes and appearances.
0
 
LVL 59
ID: 8181438
Ed,

RecordCount is a numeric value, so no quotes on the first check:
 
If Me!EDITS2SUB.Form.CurrentRecord = 0 Then
 Me!Text59 = 0
Else
 Me!EDITS2SUB.Form.RecordsetClone.MoveLast

 Me!Text59 = Me!EDITS2SUB.Form.RecordsetClone.RecordCount
End If


Jim.
0
 

Author Comment

by:wa1ed
ID: 8182032
shane

If Me!EDITS2SUB.Form.NewRecord = True Then

Worked great!
Thankyou

Did you look at that form?
Ed
WA1Ed



0
 
LVL 54

Expert Comment

by:nico5038
ID: 8182088
Using:

Parent.Text59 = Me.RecordsetClone.RecordCount

In the onCurrent event of the subform will be safer as using the IF statement in the [refresh] button.

When a user knows the right-click filter method the IF behind the button won't be executed but the OnCurrent event of the subform will.

Nic;o)
0
 

Author Comment

by:wa1ed
ID: 8182096
I maybe too easy giving everyone A's but, If you solve my problems... What else is there to give? :-)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 8183235
Ed, if you want my honest opinion about the look of the form, I have to say I liked the first version you send me better :)

Personally, I never use datasheet view but that's personal preference. Another point I would make is, if you have icons for buttons, also include a controltip or a text label to indicate the button's functionality - the icon might be obvious to us designers but users are a different matter!
0
 

Author Comment

by:wa1ed
ID: 8184801
Thankyou Shane, That is EXACTLY what I was looking for
Ed
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question