Hi i have a database with a form that i have added a checkbox to (check325), what i want to do is have a msgbox appear if command 261 is clicked to say 'please complete check box'. here is the original code.
vb Code:
  1. Private Sub Command261_Click()
  2. 'On Error GoTo Err_Command261_Click
  3.     If IsNull(Me.Text266) Or Trim(Me.Text266) = "" Then
  4.     MsgBox "Please provide Work Status", vbInformation, "Cworks"
  5.     Me.Text266.SetFocus
  6.     Exit Sub
  7.     End If
  8.  
  9.   Dim rspmsched As DAO.Recordset
  10.   Dim response
  11.  
  12.     If Me.WorkStatus.Column(0) = 2 Then
  13.     If IsNull(Me.ActDateStart) Or IsNull(Me.ActDateEnd) Then
  14.         MsgBox "Please provide an Actual Start Date and  Actual End Date", vbOKOnly + vbExclamation
  15.         Me.ActDateStart.SetFocus
  16.     Else
  17.         response = MsgBox("Closed work orders cannot be modified. Do you want to proceeed ?", vbYesNo + vbInformation + vbDefaultButton2, "Confirm Save")
  18.         If response = vbYes Then
  19.            If Me.WorkType = 2 And Me.WorkStatus = 2 Then
  20.                
  21.                Set rspmsched = CurrentDb.OpenRecordset("Select * from [PM Schedule] where [PM Schedule].PMNo='" & Replace(Me.PMNo, "'", "''") & "' and [PM Schedule].TypePMgen='2'")
  22.                     If rspmsched.EOF = False Then
  23.                             rspmsched.Edit
  24.                             rspmsched![ActualCompDate] = Format(Me.ActDateEnd, "Short Date")
  25.                             rspmsched![nextdate] = rspmsched![ActualCompDate] + (rspmsched![Frequency] * rspmsched![FreqUnits])
  26.                             rspmsched.Update
  27.                     End If
  28.                     rspmsched.Close
  29.             End If
  30.             DoCmd.Close
  31.         Else
  32.             Exit Sub
  33.         End If
  34.     End If
  35.   ElseIf Me.WorkStatus.Column(0) <> 2 Then
  36.     DoCmd.Close
  37.   End If
  38.  
  39. End Sub