PC Review


Reply
Thread Tools Rate Thread

Best way to know if a control in a datasheet sbfrm is null

 
 
David Portwood
Guest
Posts: n/a
 
      12th Jan 2008
I have a record for each contractual document (let's leave it general,
please). Actions are generated against that document. When all actions have
been resolved, the "owner" of the contractual document indicates completion
of document processing by filling in a DateCompleted field.

My Documents table is linked 1:M to an Actions table and I have a
corresponding form/subform. I want the DateCompleted field in the main form
to be disabled while there are any open Actions in the subform. To check for
this, what I do now is run a DCount() against the Actions table. This works,
but it seems unnecessarily time consuming to run a domain aggregate function
when the records are right there on the subform. It is rare to have more
than five actions for any one document.

The subform is in datasheet view, so I can't put a calculated field. I tried
code like the following in the main form's Current() event:

With Me.Actions.form.recordset
.findfirst "criteria indicating an open action"
Me.DateCompleted.enabled = .no match
end with

Doesn't work, I forget specifically why now. Anyway, the DCount() works, but
I'm hoping someone might have a faster way to do this.


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      12th Jan 2008
The DCount() is probably better than looping through the records of the
subform. It works reliably, which may not be the case for the subform (e.g.
if filtered, or timing issues if it were not loaded yet.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"David Portwood" <(E-Mail Removed)> wrote in message
news:4788280c$0$7157$(E-Mail Removed)...
>I have a record for each contractual document (let's leave it general,
>please). Actions are generated against that document. When all actions have
>been resolved, the "owner" of the contractual document indicates completion
>of document processing by filling in a DateCompleted field.
>
> My Documents table is linked 1:M to an Actions table and I have a
> corresponding form/subform. I want the DateCompleted field in the main
> form to be disabled while there are any open Actions in the subform. To
> check for this, what I do now is run a DCount() against the Actions table.
> This works, but it seems unnecessarily time consuming to run a domain
> aggregate function when the records are right there on the subform. It is
> rare to have more than five actions for any one document.
>
> The subform is in datasheet view, so I can't put a calculated field. I
> tried code like the following in the main form's Current() event:
>
> With Me.Actions.form.recordset
> .findfirst "criteria indicating an open action"
> Me.DateCompleted.enabled = .no match
> end with
>
> Doesn't work, I forget specifically why now. Anyway, the DCount() works,
> but I'm hoping someone might have a faster way to do this.


 
Reply With Quote
 
David Portwood
Guest
Posts: n/a
 
      12th Jan 2008
Thanks, Allen. This saves me time trying out things that won't work.

"Allen Browne" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The DCount() is probably better than looping through the records of the
> subform. It works reliably, which may not be the case for the subform
> (e.g. if filtered, or timing issues if it were not loaded yet.)
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "David Portwood" <(E-Mail Removed)> wrote in message
> news:4788280c$0$7157$(E-Mail Removed)...
>>I have a record for each contractual document (let's leave it general,
>>please). Actions are generated against that document. When all actions
>>have been resolved, the "owner" of the contractual document indicates
>>completion of document processing by filling in a DateCompleted field.
>>
>> My Documents table is linked 1:M to an Actions table and I have a
>> corresponding form/subform. I want the DateCompleted field in the main
>> form to be disabled while there are any open Actions in the subform. To
>> check for this, what I do now is run a DCount() against the Actions
>> table. This works, but it seems unnecessarily time consuming to run a
>> domain aggregate function when the records are right there on the
>> subform. It is rare to have more than five actions for any one document.
>>
>> The subform is in datasheet view, so I can't put a calculated field. I
>> tried code like the following in the main form's Current() event:
>>
>> With Me.Actions.form.recordset
>> .findfirst "criteria indicating an open action"
>> Me.DateCompleted.enabled = .no match
>> end with
>>
>> Doesn't work, I forget specifically why now. Anyway, the DCount() works,
>> but I'm hoping someone might have a faster way to do this.

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Value in Tab Page Subform control in Other Tab Ctrl Pg Sbfrm ctrl catrey Microsoft Access Forms 0 3rd Mar 2009 09:10 PM
How to hide columns in a form in datasheet view if null =?Utf-8?B?dG01?= Microsoft Access Form Coding 5 31st Oct 2007 10:14 PM
DataSheet on Tab Control =?Utf-8?B?R3JhaGFt?= Microsoft Access Form Coding 2 16th Jan 2007 05:29 AM
Highlight Null Fields In Datasheet Steve Wilsen via AccessMonster.com Microsoft Access Form Coding 5 8th Jun 2005 03:26 PM
Datasheet view in a tab control =?Utf-8?B?a3dfdWg5Nw==?= Microsoft Access Forms 1 16th Feb 2005 09:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:55 AM.