PC Review


Reply
Thread Tools Rate Thread

Can I reference only detail fields?

 
 
LAS
Guest
Posts: n/a
 
      16th Oct 2010
I have a loop (see below) that references all the fields in a form. Is it
possible to restrict this to the detail section of the form?

For Each fld In frmSomeForm.Fields
rstSomeRst(fld.Name) = frmSomeForm(fld.Name)
Next fld

tia
las


 
Reply With Quote
 
 
 
 
Tony Toews
Guest
Posts: n/a
 
      16th Oct 2010
On Sat, 16 Oct 2010 17:22:52 -0400, "LAS" <(E-Mail Removed)>
wrote:

>I have a loop (see below) that references all the fields in a form. Is it
>possible to restrict this to the detail section of the form?
>
> For Each fld In frmSomeForm.Fields
> rstSomeRst(fld.Name) = frmSomeForm(fld.Name)
> Next fld


One means might be to use the controls Tag Property and the Instr
function to find those controls. I prefer Instr rather than just
using an = should you decide to put multiple values in the Tag
property.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Reply With Quote
 
LAS
Guest
Posts: n/a
 
      16th Oct 2010
OK, thanks.

BTW - I see now, for this particular loop, that my question is academic,
because I should be using the rstSomeRst.Fields to drive the loop.

"Tony Toews" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Sat, 16 Oct 2010 17:22:52 -0400, "LAS" <(E-Mail Removed)>
> wrote:
>
>>I have a loop (see below) that references all the fields in a form. Is it
>>possible to restrict this to the detail section of the form?
>>
>> For Each fld In frmSomeForm.Fields
>> rstSomeRst(fld.Name) = frmSomeForm(fld.Name)
>> Next fld

>
> One means might be to use the controls Tag Property and the Instr
> function to find those controls. I prefer Instr rather than just
> using an = should you decide to put multiple values in the Tag
> property.
>
> Tony
> --
> Tony Toews, Microsoft Access MVP
> Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
> Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
> For a convenient utility to keep your users FEs and other files
> updated see http://www.autofeupdater.com/



 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      17th Oct 2010
"LAS" <(E-Mail Removed)> wrote in
news:i9d53c$alr$(E-Mail Removed):

> I have a loop (see below) that references all the fields in a
> form. Is it possible to restrict this to the detail section of
> the form?
>
> For Each fld In frmSomeForm.Fields
> rstSomeRst(fld.Name) = frmSomeForm(fld.Name)
> Next fld


I know you don't need the answer any longer, but you can do this:

For Each ctl In frmSomeForm.Section(acDetail).Controls
...
Next ctl

(the named constants for sections are actually rather hard to find
they are:

acDetail
acFooter
acGroupLevel1Footer
acGroupLevel1Header
acGroupLevel2Footer
acGroupLevel2Header
acHeader
acPageFooter
acPageHeader

These can be found by opening the Object Browser in the VBE and
searching for the acSection enum definition)

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
Tony Toews
Guest
Posts: n/a
 
      17th Oct 2010
On 17 Oct 2010 00:27:45 GMT, "David-W-Fenton"
<(E-Mail Removed)> wrote:

> For Each ctl In frmSomeForm.Section(acDetail).Controls
> ...
> Next ctl


I knew there was an answer but I didn't quite feel like going through
the help and figuring i out.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Reply With Quote
 
David-W-Fenton
Guest
Posts: n/a
 
      18th Oct 2010
Tony Toews <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> On 17 Oct 2010 00:27:45 GMT, "David-W-Fenton"
><(E-Mail Removed)> wrote:
>
>> For Each ctl In frmSomeForm.Section(acDetail).Controls
>> ...
>> Next ctl

>
> I knew there was an answer but I didn't quite feel like going
> through the help and figuring i out.


I could have cited my usual spiel on setting up custom collections,
and would have done so had it been a live issue...

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
 
Reply With Quote
 
LAS
Guest
Posts: n/a
 
      18th Oct 2010
Oh, thanks! I'm glad to know there is an answer.

"David-W-Fenton" <(E-Mail Removed)> wrote in message
news:Xns9E13D0291AFA4f99a49ed1d0c49c5bbb2@74.209.136.91...
> "LAS" <(E-Mail Removed)> wrote in
> news:i9d53c$alr$(E-Mail Removed):
>
>> I have a loop (see below) that references all the fields in a
>> form. Is it possible to restrict this to the detail section of
>> the form?
>>
>> For Each fld In frmSomeForm.Fields
>> rstSomeRst(fld.Name) = frmSomeForm(fld.Name)
>> Next fld

>
> I know you don't need the answer any longer, but you can do this:
>
> For Each ctl In frmSomeForm.Section(acDetail).Controls
> ...
> Next ctl
>
> (the named constants for sections are actually rather hard to find
> they are:
>
> acDetail
> acFooter
> acGroupLevel1Footer
> acGroupLevel1Header
> acGroupLevel2Footer
> acGroupLevel2Header
> acHeader
> acPageFooter
> acPageHeader
>
> These can be found by opening the Object Browser in the VBE and
> searching for the acSection enum definition)
>
> --
> David W. Fenton http://www.dfenton.com/
> contact via website only http://www.dfenton.com/DFA/



 
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
Creating reference fields and pulling the reference from Excel =?Utf-8?B?Qm9iIEhheWVz?= Microsoft Word Document Management 0 19th Sep 2007 02:12 PM
Reference sub-report detail textbox =?Utf-8?B?RGFuaWVs?= Microsoft Access Reports 5 13th Jun 2006 03:58 AM
Page detail - all fields in page detail move down on some records =?Utf-8?B?bWlrZWluc2YyMzU=?= Microsoft Access Reports 0 22nd Jun 2004 06:27 AM
How do I reference a value in the next record while printing detail lines? Bob Paup Microsoft Access Reports 0 9th Feb 2004 07:55 PM
Re: Subtotal detail reference? Tom Ogilvy Microsoft Excel Programming 0 1st Aug 2003 12:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:41 AM.