Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.
Private Sub cmdSave_Click() Dim Counter As Integer Dim AnalystCount As Integer 'Set the counter to blank Counter = 0 'Start with the first employee Me.EmpID = 1 'Count the number of analysts, so the loop knows when to stop AnalystCount = DCount("EmpID", "tblEmployees", "[Type]='Analyst'") 'Check to see if "All Analysts" is selected If Me.chkAllAnalysts.Value = -1 Then 'Loop through all this until we reach the last analyst Do Until Counter = AnalystCount 'Check to see if they're an analyst If Me.Type.Value = "Analyst" Then 'Add one to the counter Counter = Counter + 1 'Save the record Me.Dirty = False End If 'If we haven't reached the last analyst... If Counter <> AnalystCount Then '...move to the next employee Me.EmpID = EmpID + 1 End If Loop End If 'Let the user know that everything saved MsgBox "Saved!", vbOKOnly End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.