Private Sub Command100_Click()
On Error GoTo Command100_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Command221" Event="OnClick" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application" xmlns:a="http://schemas.microsoft.com/office/accessservices
' _AXL:/2009/11/forms"><Statements><Action Name="ApplyFilter"><Argument Name="WhereCondition">[DiscoveryDate]=[Forms]![frmNewMain]![Text218]</Argument></Action></Statements></UserInterfaceMacro>
Dim x As Integer
For x = 1 To 2
Me.Controls("Chk" & x) = False
Next x
On Error Resume Next
DoCmd.GoToRecord , "", acNewRec
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
Command100_Click_Exit:
Exit Sub
Command100_Click_Err:
MsgBox Error$
Resume Command100_Click_Exit
End Sub
If you go to new record why would you need to requery ?
also, is it possible to build in the functionality to update the values in the checkboxes when switching records? or does that code need to be separate from the code to delete records from the table?
Private Sub Form_Current()
Dim db As dao.Database
Dim rs As dao.Recordset
Dim strSQL As String
Dim x As Integer
For x = 1 To 2
Me.Controls("Chk" & x) = False
Next x
Set db = CurrentDb
strSQL = "SELECT ClassificationID FROM tblIncidentClassifications WHERE tblIncidentClassifications.InternalIncidentID = '" & Me.InternalIncidentID & "'"
Set rs = db.OpenRecordset(strSQL)
Do While Not rs.EOF
Me.Controls("Chk" & rs!ClassificationID) = True
rs.MoveNext
Loop
rs.Close
db.Close
End Sub
Okay thanks! I will add in the additional check boxes so that it works smoothly with no errors.