0

I am currently trying to do some lock downs on a combobox within Access and I’m not sure if I can. The flow of the form is that a user will select a part, then, area, and then a process group. Afterwards there will be a list of items in the process steps. The process group selection is based upon what part is selected and the area. The process steps is based upon which process group is selected. Process steps selection

What I want to achieve is so that a user has to go through the list in chronological order. There are some steps that shouldn’t be started until the previous is done. Currently when the user has completed a step, they will click a button that runs an update query to change the comp_count status from 0 to a 1 for that step. Process Status Table

I’m not sure I can use the comp_count for the lockdown and if I can, how can I make it so the first item in the list is always selectable. In addition I would prefer if all off the items in the dropdown are visible, but the ones that are not available be greyed out.

vxd128
  • 71
  • 10

2 Answers2

0

You can't grey it out, but you can tell the user not to pick it:

Private Sub myCombo_BeforeUpdate(Cancel As Integer)
If Not Me.myCombo.Column(1) Then
  MsgBox "Do not choose this one yet."
  Cancel = True
End If
nicomp
  • 4,344
  • 4
  • 27
  • 60
0

I ended up finding a non elegant solution but it works. I added one column to the process status table called "Check" with default value of 0. Then I created a query that would change the value of that field for any of the processes that had the sequential value of 1. Then I created a two queries to compare the "Comp_Count" with "Check". I then created an after update event for my selection.

Private Sub Sel_Process_AfterUpdate()
If DCount("*", "qry_process_step_check") = DCount("*", "qry_process_step_check_count") Then
Update_All_Forms
Else
MsgBox ("Previous step/steps not done.")
End If
End Sub

I then created a series of queries that did a similar check function like I used for the process step selection. Check Query 2 In addition to those queries I also created an update query. Update Query

This is where the non elegant portion came in. I made 16 copies of each of these queries and changed the sequential number each was looking for. After this was completed, I changed the on click event for a button that would update "Comp_Count" field in Process_Status table. Here's a sample of the code used.

Private Sub Refresh_Sign_Offs_Button_Click()
If DCount("*", "qry_verifications_check_count") = DCount("*", "qry_verifications_check") And DCount("*", "qry_sub_verif_check_count") = DCount("*", "qry_Sub_Verif_check") And DCount("*", "qry_measurements_check_count") = DCount("*", "qry_measurements_check") And DCount("*", "qry_equipment_check_count") = DCount("*", "qry_equipment_check") And DCount("*", "qry_kits_check_count") = DCount("*", "qry_kits_check") And DCount("*", "qry_material_check_count") = DCount("*", "qry_material_check") Then
 Me.Completed.Visible = True
 DoCmd.SetWarnings False
 DoCmd.OpenQuery ("qry_update_process_status")
 DoCmd.SetWarnings True
MsgBox ("Process has been completed.")
If DCount("*", "qry_seq1check") = DCount("*", "qry_seq1count") Then
    DoCmd.SetWarnings False
    DoCmd.OpenQuery ("qry_seq1u")
    DoCmd.SetWarnings True


ElseIf DCount("*", "qry_seq2check") = DCount("*", "qry_seq2count") Then
    DoCmd.SetWarnings False
    DoCmd.OpenQuery ("qry_seq2u")
    DoCmd.SetWarnings True
Else
  Me.Completed.Visible = False
  MsgBox ("Not all items filled out.")
End If

The only thing missing in code above is the rest of elseif statements I was using. It's not the most elegant solution, but it will do everything I need it to do.

vxd128
  • 71
  • 10