DCount Control Update or Focus

Thanks Core for pointing me to khawar's solution.

I'll now try to stumble my way through how to do it. I know next to nothing on vba and am just starting to find my way around Access after not using it for more than a decade.

This will be a good learning start point.
 
Boomslanger ...

I would suggest that you use DCount() against the TABLE and NOT a query, just enter your criteria in the third argument ... (my sample ASSUMES, [Asset] is a TEXT datatyped field)
Code:
=DCount("*", "tbl_Assets", "[Asset]='" & [Asset] & "'")
 
Thanks, I'll try that next week.

As luck would have it just when I get to play with the database I have to go on the road for a bit.

I'll let you all know how I go when I get back from my road trip.
 
=DCount("*","tbl_Assets","[Asset]='" & [Asset] & "'")

That code did working perfectly for just one afternoon. I had saved the form and did nothing else but close Access for the day.

I come in this morning to start work, open the database and get the Name? error in the control box for that code. What would have made it stop working after it had been doing exactly what it was supposed to the day before?

------------------
Something else is going on that is screwing things up. A simple query that has worked flawlessly for weeks now all of sudden is no longer producing any results though on checking the query nothing has changed.

------------------
...and believe it or not it's working again after I made some cosmetic changes to a completely unrelated form then came back to Assets Under Management form.

Access can sure drive you up the wall.
 
Last edited:
... Hmm ...

Did you get this figured out? ... or is it still running fine ...

My first question would be .. IS there a control on the form named "Asset"? ...
 
Thanks for keeping up on this.

Yes I got it working using this simple solution as the Control Source:

=DCount("*","tbl_Assets","[Asset]='" & [Asset] & "'")

Have another requirement I was going to raise later but might as well give a heads up now.

Each Asset in the Asset Management Form can be made up of many components, whose brief description taken from a one to many related Components table is given in a subform under a tab. I need to bring up another split form which has the name of the asset and a detailed list of its components. I am thinking of using a button on the subform which brings up the detailed components form.

How do I ensure that when I click on the button in the subform of the Asset form the detailed Components form opens with the current Asset and not the first record?
 

Users who are viewing this thread

Back
Top Bottom