The Bang! (Exclamation Operator) in VBA

April 11, 2013 in VBA

One of the most peculiar aspects of Visual Basic for Applications in the ! operator, called the “bang”. It is particularly common in code for Microsoft Access, where you may see things like this: strCriteria = “EmployeeID = ” & Me!txtEmplID Set rst = CurrentDb.OpenRecordSet(“SELECT * FROM Employees WHERE ” & strCriteria) If Not rst.EOF Then Me!txtName = rst!Name Me!txtTitle = rst!Title Me!txtHireDate = rst!HireDate End If rst.Close Set rst = Nothing There’s a lot of confusion about the bang operator, and nowhere have I seen the correct whole story about it. So, I present it here! Definition: The Bang
…read more