This one is driving me nuts I have to ask to If statements and I cant seem to get it right is there a better way. This is the code
On Error GoTo Err_Readme_Click
If DCount("[Part Number]", "[tble-Parts History]", "[Part Number] = '" & Me.[Part Number] & "' AND [system] = " & Me.[system] & " AND [Chamber] = '" & Me.[Chamber] & "' AND [Currently in use] = True") > 0 Then
Dim StdResponse As Integer
DoCmd.SetWarnings False
StdResponse = MsgBox("This Part is already configured in this chamber. Is this part replacing the one currently configured?", 52)
If StdResponse = 6 Then 'Yes
Dim stDocName As String
stDocName = "Qry-parts reset current"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
Else ' No
End If
Dim StdResponse1 As Integer
DoCmd.SetWarnings False
StdResponse1 = MsgBox("Is this a multiple used part in this chamber?", 52)
If StdResponse1 = 6 Then 'Yes
'Part ok
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
Exit Sub
Else
'User said No
Me.[Part Number] = Null
Me.[Part Description] = Null
Me.[Currently in use] = False
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
End If
Exit Sub
Exit_Readme_Click:
Exit Sub
Err_Readme_Click:
MsgBox Err.Description
Resume Exit_Readme_Click
End If
End Sub
On Error GoTo Err_Readme_Click
If DCount("[Part Number]", "[tble-Parts History]", "[Part Number] = '" & Me.[Part Number] & "' AND [system] = " & Me.[system] & " AND [Chamber] = '" & Me.[Chamber] & "' AND [Currently in use] = True") > 0 Then
Dim StdResponse As Integer
DoCmd.SetWarnings False
StdResponse = MsgBox("This Part is already configured in this chamber. Is this part replacing the one currently configured?", 52)
If StdResponse = 6 Then 'Yes
Dim stDocName As String
stDocName = "Qry-parts reset current"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
Else ' No
End If
Dim StdResponse1 As Integer
DoCmd.SetWarnings False
StdResponse1 = MsgBox("Is this a multiple used part in this chamber?", 52)
If StdResponse1 = 6 Then 'Yes
'Part ok
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
Exit Sub
Else
'User said No
Me.[Part Number] = Null
Me.[Part Description] = Null
Me.[Currently in use] = False
DoCmd.close acForm, "Frm-Adding Process Parts"
DoCmd.close acForm, "Frm-Process kit Parts Installed"
DoCmd.OpenForm "Frm-Parts Main"
End If
Exit Sub
Exit_Readme_Click:
Exit Sub
Err_Readme_Click:
MsgBox Err.Description
Resume Exit_Readme_Click
End If
End Sub