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

Form won't open to "Read Only"

Status
Not open for further replies.

mguidry5

Technical User
Jan 11, 2005
91
0
0
US
I'm trying to open a child form as acReadOnly from a main form with link criteria. The child form has an OnOpen event that sets the Enabled property to true or false for controls on the child form. If I try to open the Child form as acReadOnly, and some of my controls used in the OnOpen event have null values, I get Run-time error 2427.

Is there a way to allow this form to open as read only with null values? I've posted my code for the OnOpen event. Any help would be greatly appreciated.
Code:
Private Sub Form_Open(Cancel As Integer)

If Me.AddSSMP.Value = 2 Or Me.ConSSMP.Value = 2 Then
        Me.Reasons.Enabled = True
        Me.CorrActions.Enabled = True
    Else
        Me.Reasons.Enabled = False
        Me.CorrActions.Enabled = False
    End If
    
If HWCmactX.Value = 1 Then
    Me.HWinChamber.Enabled = True
    Else
        Me.HWinChamber.Enabled = False
    End If
    
If HWinChamber.Value = 1 Then
    Me.XceedStart.Enabled = True
    Me.XceedStop.Enabled = True
    Else
        Me.XceedStart.Enabled = False
        Me.XceedStop.Enabled = False
    End If
    
End Sub
 
I am not sure if this will help in your specific situation, but look up the Nz function and what it's purpose is. Go to HELP and just type in nz.




HTH

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
Autonumber Description - FAQ702-5106
 
One thing you may want to try is rather then using the On Open event try the On Load event. The reason is that the On Open occurs before the record set has been loaded. The On Load event occurs after the record set is loaded.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top