A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to reach through subform to underlying table?



 
 
Thread Tools Display Modes
  #1  
Old April 30th, 2010, 12:31 AM posted to microsoft.public.access
wdsnews
external usenet poster
 
Posts: 170
Default How to reach through subform to underlying table?

With VBA I've learned to pull data from fields on my subform like this:
sbfVendorDetail.Form.[Start Date]. However, fields such as the ID may not
be on the subform since the user doesn't need to see it and it would take up
space. Is there a way to read the ID field of the current record of the
subform without putting the field on the form?


  #2  
Old April 30th, 2010, 01:26 AM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default How to reach through subform to underlying table?

"WDSnews" wrote in message
...
With VBA I've learned to pull data from fields on my subform like this:
sbfVendorDetail.Form.[Start Date]. However, fields such as the ID may not
be on the subform since the user doesn't need to see it and it would take
up space. Is there a way to read the ID field of the current record of
the subform without putting the field on the form?



If the field is in the form's (subform's) recordset -- that is, included in
whatever set of fields are selected by the form's recordsource query -- then
you can access it the exact same way:

Me.sbfVendorDetail.Form.[ID]

In some circumstances you may find that you need to prefix the field name
with a bang (!) instead of a dot (.), like this:

Me.sbfVendorDetail.Form![ID]

If the field is not in the form's recordset, though, you can't do that.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #3  
Old April 30th, 2010, 01:30 AM posted to microsoft.public.access
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default How to reach through subform to underlying table?

The easiest method is to put it on the form or subform and set its Visible
Property to False. Then you can call it the same way.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"WDSnews" wrote in message
...
With VBA I've learned to pull data from fields on my subform like this:
sbfVendorDetail.Form.[Start Date]. However, fields such as the ID may not
be on the subform since the user doesn't need to see it and it would take
up space. Is there a way to read the ID field of the current record of
the subform without putting the field on the form?




 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.