dominicgingras
Technical User
I have a form that I use to do my order entry. When the order is complete, I want to disable some of the sub-form.
So far I have use something like that
Private Sub Form_Current()
If [Status] = "Invoiced" Then
ReadOnly = "Read Only"
InvoiceButton.Enabled = False
Me.AllowEdits = False
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = False
End If
If [Status] = "Ordered" Then
ReadOnly = ""
Me.AllowEdits = True
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = True
InvoiceButton.Enabled = True
End If
If [Status] = "Pending" Then
ReadOnly = ""
Me.AllowEdits = True
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = True
InvoiceButton.Enabled = False
End If
End Sub
As you can see this is very long.
Also I get a problem if my user press a button on the form that display a list box with some choice, when he go back to the from, It is not disable anymore
This is probably not the right method for doing this.
Any idea?
So far I have use something like that
Private Sub Form_Current()
If [Status] = "Invoiced" Then
ReadOnly = "Read Only"
InvoiceButton.Enabled = False
Me.AllowEdits = False
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = False
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = False
End If
If [Status] = "Ordered" Then
ReadOnly = ""
Me.AllowEdits = True
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = True
InvoiceButton.Enabled = True
End If
If [Status] = "Pending" Then
ReadOnly = ""
Me.AllowEdits = True
[Forms]![WorkOrder].[TasksSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[BillingDetailsSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[NoteSubform].Form.AllowEdits = True
[Forms]![WorkOrder].[SchedulingSubform].Form.AllowEdits = True
InvoiceButton.Enabled = False
End If
End Sub
As you can see this is very long.
Also I get a problem if my user press a button on the form that display a list box with some choice, when he go back to the from, It is not disable anymore
This is probably not the right method for doing this.
Any idea?