Code:
Table 1
Private Sub Method_BeforeUpdate(Cancel As Integer)
'Electrofishing Form #1 in Methods Table
If Me.Method = 1 Then
Me.cmdElectrofishing.Visible = True
End If
If Me.Method = 1 Then
DoCmd.OpenForm "Electrofishing", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Temp_Logger Table #6 in Methods Table
If Me.Method = 6 Then
Me.cmdTempLogger.Visible = True
End If
If Me.Method = 6 Then
DoCmd.OpenForm "Temp_Logger", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Angling Form #7 in Methods Table
If Me.Method = 7 Then
Me.cmdAngling.Visible = True
End If
If Me.Method = 7 Then
DoCmd.OpenForm "Angling", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Gillnet Form #8 in Methods Table
If Me.Method = 8 Then
Me.cmdGillnet.Visible = True
End If
If Me.Method = 8 Then
DoCmd.OpenForm "Gillnet", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Seining Form #9 in Methods Table
If Me.Method = 9 Then
Me.cmdSeining.Visible = True
End If
If Me.Method = 9 Then
DoCmd.OpenForm "Seining", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Fyke_Net Form #10 in Methods Table
If Me.Method = 10 Then
Me.cmdFykeNet.Visible = True
End If
If Me.Method = 10 Then
DoCmd.OpenForm "Fyke_Net", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Minnow_Trap Form #11 in Methods Table
If Me.Method = 11 Then
Me.cmdMinnowTrap.Visible = True
End If
If Me.Method = 11 Then
DoCmd.OpenForm "Minnow_Trap", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Trotline Form #12 in Methods Table
If Me.Method = 12 Then
Me.cmdTrotLine.Visible = True
End If
If Me.Method = 12 Then
DoCmd.OpenForm "Trotline", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Hoop_Net Form #13 in Methods Table
If Me.Method = 13 Then
Me.cmdHoopNet.Visible = True
End If
If Me.Method = 13 Then
DoCmd.OpenForm "Hoop_Net", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Trammel_Net Form #14 in Methods Table
If Me.Method = 14 Then
Me.cmdTrammelNet.Visible = True
End If
If Me.Method = 14 Then
DoCmd.OpenForm "Trammel_Net", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
'Stream_Temp_Profile Form #20 in Methods Table
If Me.Method = 20 Then
Me.cmdStreamTempProfile.Visible = True
End If
If Me.Method = 20 Then
DoCmd.OpenForm "Stream_Temp_Profile", , , , acFormAdd, acDialog, Me.SamplingEventID
End If
RunCommand acCmdSave
DoEvents
End Sub
Table 2
Private Sub CloseForm_Click()
Forms!Sampling_Event.Method.Locked = True
If Me.StationLength = 0 Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Forms!Sampling_Event.Method.Locked = False
End If
If Me.StationLength = 0 Then
Forms!Sampling_Event.cmdElectrofishing.Visible = False
End If
DoCmd.Close
End Sub
When I run, I get an error message that says "You can't lock a control while it has unsaved changes". I thought I saved the field at the end with RunCommand. Help or ideas?