Solved

DCount in Bound Field

Posted on 2011-03-09
5
314 Views
Last Modified: 2012-06-27
I am having trouble using DCount in a bound text field. Is this possible? I can use the following syntax to get the result in an unbound control in a query, but would like to place the results in a bound field in a table. Thanks.

Sets: DCount("SetsRepID","tblSetsDetail","SetsRepID = " & [StrID])
0
Comment
Question by:skennelly
  • 3
5 Comments
 
LVL 75
ID: 35087202
"in a bound text field. "
You mean on a Form ?

You can do this ... set the Control Source of an *unbound* Text box to:

=DCount("SetsRepID","tblSetsDetail","[SetsRepID] = " & [StrID])

Not completely sure what you   mean ...

mx
0
 
LVL 57
ID: 35087222
<<I am having trouble using DCount in a bound text field. Is this possible?>>

 No it's not possible.  You'll need to set the control (or field that the control is bound to) in code from somewhere else.

JimD.
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 125 total points
ID: 35087253
You can also do this ... to set a Field in your table, using the Form Before Update event.

Private Sub Form_BeforeUpdate (Cancel As Integer)

me![YourFieldNameInTheTable] = DCount("SetsRepID","tblSetsDetail","SetsRepID = " & [StrID])

End Sub

mx
0
 

Author Closing Comment

by:skennelly
ID: 35087621
Got it, thanks.
0
 
LVL 75
ID: 35087640
You are welcome ...

mx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now