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

controling subform through VBA

Status
Not open for further replies.

00trav

Technical User
Mar 6, 2006
8
US
I have a form with several subforms. Most of which are locked . meaning AllowEdits = False, along with additions, and deletions.

main form name: frmCoOpEdit
subform: sfrmCoOpDetail

i have a toggle button on the page that is pressed to signify that they record is complete, once this record is complete i want all the fields in the form to be locked. but i still want the user to have the ability to call up the form to view the data and use the other buttons on the form to view reports, print, and send the record.

i have included this code on the form_load sub
Code:
Private Sub Form_Load()
    'complete toggle
    If Me!Pending.Value = 0 Then
        Me!Pending.Caption = "Pending"
    ElseIf Me!Pending.Value = -1 Then
        Me!Pending.Caption = "Complete"
    End If
    
    'confirmed toggle
    If Me!togConfirmed.Value = 0 Then
        Me!togConfirmed.Caption = "Pending"
    ElseIf Me!togConfirmed.Value = -1 Then
        Me!togConfirmed.Caption = "Confirmed"
        Me!Pending.Enabled = False
        Form.AllowEdits = False
        Forms!frmCoOpEdit!sfrmCoOpDetail.AllowEdits = False

    End If

End Sub
the first if statement just changes the text on a button depending on the value of a field, the second if statement works perfectly with the exception of the last line

how do i control the allowEdits attribute of the subform sfrmCoOpDetail

i have tried
sfrmCoOpDetail.AllowEdits = False
Me!sfrmCoOpDetail.AllowEdits = False

and a bunch of other ways, i can't get it to recognize, by searching this forum i found that I think this is the way
Forms!frmCoOpEdit!sfrmCoOpDetail.AllowEdits = False
but i keep getting an error : Object doesn't support this property of method.

any ideas

 
And this ?
Me!sfrmCoOpDetail.Form.AllowEdits = False

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
you are a genious,
i did try that before, but i had the name wrong , i had sfrmCoOpDetails.form.allowedits

and i didn't even read the error message,

dumb me,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top