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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AllowEdits in Nested Subform

Status
Not open for further replies.

jwhalen29

Programmer
Mar 12, 2002
15
US
Within my main form I have four levels of nested subform. Each subform is a datasheet. From the On_Load event of the main form, I call a procedure to turn on/off editing of the subforms based on the login ID. I can only change the allowedits property of the highest level subform. If I try setting this property on any subform nested below that, I get message #2455, "You entered an expression that has an invalid reference to the property Form/Report." Here is the code I am using to set allowedits in a subform (fsubProjects is the top-level subform):

Me!fsubProjects.Form!fsubProjections.Form.AllowEdits = False

I think what I'm trying to do is possible, so I'm not sure if I can't do it from the load event, or if it is because I am using datasheets.
 
I'm not sure how you can "nest" datasheet subforms in other datasheets. What version of Access are you using? You must reference the names of the subform controls rather than the names of the subform object.

Duane
Hook'D on Access
MS Access MVP
 
The datasheet subforms look like any subform in design view, but I set the default view of each subform to datasheet.

I am sure I'm using the control name - I've checked this several times. The control and object have the same name.
 
I am with Duane. I know of no way to nest datasheet subforms or continous forms. I think you are not describing correctly what you are doing.

Either the subforms are not nested or they are not datasheet/continous. Or you have a dataheet with subdatasheets. A datasheet with subdatasheets is not the same as a subform.

Can you describe this better.
 
Sorry, maybe I'm using the wrong terminology. I guess they are considered subdatasheets. I created them just as I would a subform - by dragging a form onto another form, but then set the default view to datasheet.

So, let me rephrase my question. Can I set allowedits on a subdatasheet? Can this be done from a form two or three levels up?

Thanks for your patience and help!
 
It turns out my vba was correct, but the nested subdatasheets cannot be referenced until they are actually opened (expanded). I had to move the code from the main form to the subdatasheet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top