Category: Visual Basic for Applications
Avoid error “2427 You entered an expression that has no value” when passing a parameter to a form
To avoid getting an error when passing a variable to a form, using If Not against the EOF (I believe means End of File) property. If Not Me.Recordset.EOF And Not Me.Recordset.EOF Then Dim stDocName As String Dim stLinkCriteria As String stDocName = “someform” stLinkCriteria = “[recordnumber]=” & Me.[recordnumber] DoCmd.OpenForm stDocName, , , stLinkCriteria Else MsgBox…
In VBA strip out characters which cause TSQL to fail
A simple way to strip out characters which can cause TSQL Code to break. Assumes the SQL commannd is in sqlstatement and you are passing a variable in me.comment, before executing the code. ‘Allows Characters such as , and ‘ which may break TSQL Code and Cause Injection sqlstatement = RTrim(sqlstatement) + “,’Me.comment & “‘”…
Microsoft Access 2010 loader
Credits (As what I consider the hard stuff was actually done by other people): TheSmileyCoder for the solid awesome little VBS File, this basically gets around the limitation of not actually getting Access to load another Access Database. At the time I only ever needed one modification (A rarely issue affected two P4 machines with…
Outlook 2010: VBA delay sending of emails until the next working day if outside of reasonable hours
This Outlook 2010 VBA code was used to impose a time when emails could not be sent and were instead delayed until the next work day. This was put together (Credits go to key parts of this VBA are in the actual code) because the Managing Director where I work realised he was making people…