Hmn..no. I take this back. they are not related.RuralGuy said:Are the two tables related? Can you put them both in the same query?
yes, i wanna delete when he unchecks tooRuralGuy said:You could easily add a record to that other table when you check the CheckBox but are you prepared to delete the record when the user UnChecks the CheckBox?
 
 
Private Sub ChkBox_Click()
On Error GoTo Err_ChkBox_Click
Dim MySQL As String
If Me.chkActive Then
   '-- CheckBox going to "Checked" state
   MySQL = "Insert Into YourTableName(ID,FullName) " & _
        "Values(" & Me.IDControl & ", """ & Me.FullNameControl & """)"
Else
   '-- CheckBox going to "UnChecked" state
   MySQL = "DELETE * FROM YourTableName WHERE [ID] = " & Me.IDControl
End If
CurrentDb().Execute MySQL, dbFailOnError
Exit_ChkBox_Click:
   Exit Sub
Err_ChkBox_Click:
   MsgBox "Error No:    " & Err.Number & vbCr & _
   "Description: " & Err.Description
   Resume Exit_ChkBox_Click
End Sub *muah
  *muahPrivate Sub chkNoSupportHrs_Click()
On Error GoTo Err_ChkBox_Click
Dim MySQL As String
If Me.ActiveControl Then
   '-- CheckBox going to "Checked" state
   MySQL = "Insert Into tblNoSupportHrs(ShortID,WeekEnding) " & _
        "Values(" & Me.txtResource & ", """ & Me.Text18 & """)"
Else
   '-- CheckBox going to "UnChecked" state
   MySQL = "DELETE * FROM tblNoSupportHrs WHERE [ShortID] = " & Me.txtResource
End If
CurrentDb().Execute MySQL, dbFailOnError
Exit_ChkBox_Click:
   Exit Sub
Err_ChkBox_Click:
   MsgBox "Error No:    " & Err.Number & vbCr & _
   "Description: " & Err.Description
   Resume Exit_ChkBox_Click
End Sub
Private Sub chkNoSupportHrs_Click()
On Error GoTo Err_ChkBox_Click
Dim MySQL As String
If Me.[b]chkNoSupportHrs[/b] Then
   '-- CheckBox going to "Checked" state
   MySQL = "Insert Into tblNoSupportHrs(ShortID,WeekEnding) " & _
        "Values(" & Me.txtResource & ", """ & Me.Text18 & """)"
Else
   '-- CheckBox going to "UnChecked" state
   MySQL = "DELETE * FROM tblNoSupportHrs WHERE [ShortID] = " & Me.txtResource
End If
[b]MsgBox MySql[/b]
CurrentDb().Execute MySQL, dbFailOnError
Exit_ChkBox_Click:
   Exit Sub
Err_ChkBox_Click:
   MsgBox "Error No:    " & Err.Number & vbCr & _
   "Description: " & Err.Description
   Resume Exit_ChkBox_Click
End Sub 
 

RuralGuy said:Sorry, I was out on the tractor getting ready for winter.
 
  
  
 MsLady said:I checked my fields, they are properly set
Could this be because my form calculates some fields from other form (getselectedweek() and Weekending)? This is the record source of this form.
SELECT * FROM dbo_LDR_Support WHERE (((dbo_LDR_Support.Resource)=shortID()) And ((dbo_LDR_Support.WeekEnding)=getSelectedWeek())) ORDER BY SupportID;

RuralGuy said:You are treating shortID like a function! shortID() What is that all about?
