Hi

I have created a procedure as following:
Public Sub setFormAttributeSingle(str As String, Optional sub1 As String)
Dim frm As Form
If user_type = 3 Then
DoCmd.OpenForm str, acNormal
Forms(str).RecordsetType = 3
If sub1 = "" Then
Exit Sub
Else
Forms(str).Form(sub1).RecordsetType = 3
End If

Else
DoCmd.OpenForm str, acNormal
Forms(str).RecordsetType = 0
If sub1 = "" Then
Exit Sub
Else
Forms(str)!frm(sub1).RecordsetType = 0
End If
End If
End Sub

This has two parameters one mandatory and one optional. The mandattory parameter (str) is main form and optional parameter (sub1) is subform. Would like to open the forms and make change recordsetype. For main form it works but for subform it does not work. Please refer to Forms(str)!frm(sub1).RecordsetType = 3


Thanks for the help and hints