Solved

DCount in Bound Field

Posted on 2011-03-09
5
352 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 - Microsoft MVP, Access and Data Platform) 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

828 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