Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get CurrentRecord of subform?

Status
Not open for further replies.

jkcohen

MIS
Apr 15, 2002
1
US
I am thoroughly perplexed. I am trying to create an unbound control on a subform that will give me the CurrentRecord property for the given line item. I am using the sample code from the Access documentation:
[tt]
function CurrentFormRecord(frm as Form)
dim lngrecordnum as Long
lngrecordnum = frm.CurrentRecord
CurrentFormRecord = lngrecordnum
end function
[/tt]

However, I cannot seem to pass the function a form that it will accept. I've tried passing it "Me" and "[Forms]![sfrmMyForm]", both of which create errors. Screen.ActiveForm will only return me the form enclosing the subform. RunningSum only works in reports.

What do I have to do to pass the CurrentFormRecord function the current subform?

Sincerely, Jonathan
 
If you're in the subform module Me should work; make sure you're not enclosing it in quotes when you pass it.

If you want to use the Forms!... syntax it's like this:

Forms!MainFormName!subFormControlName.Form "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top