Posts Tagged ‘microsoft’

Finding the lowest non-zero value of multiple columns in Microsoft Access

Programming | Posted by epistasis
Jul 01 2014

Recently (for work) I wanted to find the lowest non-zero value of multiple columns in Microsoft Access. I had to trawl the Internet for the best way to do this and in the end worked with a mixture of several methods from different websites. I hope that this post will serve as a single point of reference for anybody wanting to do the same thing.

In this example I will use the following table:

003

 

1) First you need to open the VB editor:

001

2) Create a new module:

002

3) Paste in this code:

Function MinColumn(ParamArray FieldArray() As Variant)

Dim I As Integer
Dim currentVal As Variant

currentVal = FieldArray(0)

'Loop through each value in the columns
For I = 0 To UBound(FieldArray)
    'If the the column we're checking is lower than the last (and non-zero), take it
    If FieldArray(I) < currentVal And FieldArray(I) <> 0 Then
        currentVal = FieldArray(I)
    End If
    
    'If the current value is zero and we find a higher value, take it
    If currentVal = 0 And FieldArray(I) Then
        currentVal = FieldArray(I)
    End If
Next I

MinColumn = currentVal

End Function

4) Close the VB editor

5) Create this query:

SELECT EmployeeLastName,
MinColumn(EmployeeRate1, EmployeeRate2, EmployeeRate3, EmployeeRate4) AS LowestRate
FROM Employee

You should end up with the following results:

004

 

Windows 7 </3 IE8

Windows 7 | Posted by epistasis
Mar 06 2009

Hmm, so Microsoft have confirmed that users of Windows 7 will be able to ‘turn on or off’ Internet Explorer. Or have they? Turning off IE8 in Windows 7 seemingly does what was already possible – that is, simply deletes the iexplore.exe file. This is hardly ‘disabling’ the browser, as many DLLs and other parts of the browser still remain, not to mention that Windows will probably ask you a thousand times if you’re sure you want to disable it.

I think it’s fairly safe to say that the only reason Microsoft are doing this is to appease Brussels. They’ve got the anti-trust case over including IE with Windows and this is a quickfix.. or should I say hotfix. Oh it makes sense now.. if it’s a hotfix.. it’s meant to be rubbish.

Anyway, I’m going to toddle off and find a copy of build 7048 now and check out the differences between it and the public beta (build 7000). Wish me luck 🙂