?
Solved

DCount in Bound Field

Posted on 2011-03-09
5
Medium Priority
?
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58
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 - Microsoft MVP, Access and Data Platform) earned 500 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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 …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

801 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