From: WDSnews on
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?


From: Dirk Goldgar on
"WDSnews" <wdsnews.0640(a)oregoncity.com> wrote in message
news:eQAVmQ$5KHA.980(a)TK2MSFTNGP04.phx.gbl...
> 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)

From: Arvin Meyer [MVP] on
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" <wdsnews.0640(a)oregoncity.com> wrote in message
news:eQAVmQ$5KHA.980(a)TK2MSFTNGP04.phx.gbl...
> 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?
>
>


 | 
Pages: 1
Prev: Access 2002 Runtime and Windows 7
Next: Brazil