|
Question : Microsoft Access form navigation VBA question - making fields active or inactive
|
|
I have a form in Access that users use to track Maintenance Work Orders. When a work order is complete they select a button called "close_order" and the following action occurs: ------------------------------------------------------------------------------- Private Sub Close_Order_Click() On Error GoTo Err_Close_Order_Click
If [Complete] = -1 Then [Complete] = 0 [Completion Date] = Null
Else [Complete] = -1 [Completion Date] = Now() End If
If [Complete] = -1 Then [Work order number].Enabled = False [Start Date].Enabled = False [Maintenance Person].Enabled = False [Work order Date].Enabled = False [Completion Date].Enabled = False [MaintenanceVendorID].Enabled = False [Work Type].Enabled = False [Requestor].Enabled = False [Emergancy Rating].Enabled = False [MachineID].Enabled = False [Requested Date].Enabled = False [Safety Issue].Enabled = False [Materials].Enabled = False [Reason/Problem].Enabled = False [Comments].Enabled = False
Else [Work order number].Enabled = True [Start Date].Enabled = True [Maintenance Person].Enabled = True [Work order Date].Enabled = True [Completion Date].Enabled = True [MaintenanceVendorID].Enabled = True [Work Type].Enabled = True [Requestor].Enabled = True [Emergancy Rating].Enabled = True [MachineID].Enabled = True [Requested Date].Enabled = True [Safety Issue].Enabled = True [Materials].Enabled = True [Reason/Problem].Enabled = True [Comments].Enabled = True End If
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_Close_Order_Click: Exit Sub
Err_Close_Order_Click: MsgBox Err.Description Resume Exit_Close_Order_Click End Sub -------------------------------------------------------------------------- Then to navigate, they use buttons "Previous_Record" or "Next_Record" that share the following code: -------------------------------------------------------------------------- Private Sub Next_Record_Click() On Error GoTo Err_Next_Record_Click
DoCmd.GoToRecord , , acNext If [Complete] = -1 Then [Work order number].Enabled = False [Start Date].Enabled = False [Maintenance Person].Enabled = False [Work order Date].Enabled = False [Completion Date].Enabled = False [MaintenanceVendorID].Enabled = False [Work Type].Enabled = False [Requestor].Enabled = False [Emergancy Rating].Enabled = False [MachineID].Enabled = False [Requested Date].Enabled = False [Safety Issue].Enabled = False [Materials].Enabled = False [Reason/Problem].Enabled = False [Comments].Enabled = False Else [Work order number].Enabled = True [Start Date].Enabled = True [Maintenance Person].Enabled = True [Work order Date].Enabled = True [Completion Date].Enabled = True [MaintenanceVendorID].Enabled = True [Work Type].Enabled = True [Requestor].Enabled = True [Emergancy Rating].Enabled = True [MachineID].Enabled = True [Requested Date].Enabled = True [Safety Issue].Enabled = True [Materials].Enabled = True [Reason/Problem].Enabled = True [Comments].Enabled = True End If
Exit_Next_Record_Click: Exit Sub
Err_Next_Record_Click: MsgBox Err.Description Resume Exit_Next_Record_Click End Sub ------------------------------------------------------------------------ The problem is that my users keep using the arrows at the bottom of the screen to navigate. When they do this, and "check" the button called "close_order" all the fields on the other work orders are disabled. Is there some better code I can use or a way to disable those pesky arrows on this form, but keep it visiable on others? Your help/suggestions would be apprecaited
|
|
Answer : Microsoft Access form navigation VBA question - making fields active or inactive
|
|
If you go to Form Properties you can disable the Record Selector Buttons,
Navigation Buttons = No Record Selectors = No
|
|
|
|