MS Access VBA for NumLock Control

Option Compare Database
Option Explicit

Private Declare PtrSafe Sub keybd_event Lib "user32" ( _
    ByVal bVk As Byte, _
    ByVal bScan As Byte, _
    ByVal dwFlags As Long, _
    ByVal dwExtraInfo As Long)
    Private Const VK_NUMLOCK = &H90
    Private Const KEYEVENTF_KEYUP = &H2
    Declare Function GetKeyState Lib "user32.dll" ( _
    ByVal nVirtKey As Long) As Integer
 
Public Sub NUM_TOGGLE()
    keybd_event VK_NUMLOCK, 1, 0, 0
    keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
End Sub
 
Public Sub NUM_On()
    If Not (GetKeyState(vbKeyNumlock) = 1) Then
        keybd_event VK_NUMLOCK, 1, 0, 0
        keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
    End If
End Sub
 
Public Sub NUM_Off()
    If (GetKeyState(vbKeyNumlock) = 1) Then
        keybd_event VK_NUMLOCK, 1, 0, 0
        keybd_event VK_NUMLOCK, 1, KEYEVENTF_KEYUP, 0
    End If
End Sub

How to Unblock Unsafe Attachments in Microsoft Outlook

https://www.sitepoint.com/outlook-unblock-unsafe-attachments/

There’s a vast range of desktop and online email clients but it’s hard to beat Microsoft Outlook. The application has been around since 1997 and, despite a few dodgy decisions regarding HTML rendering, it’s still the email client of choice for me and many others.

Unfortunately, there’s an Outlook message web developers hate:

Outlook blocked access to the following potentially unsafe attachments…

Thanks Microsoft. I know why you’re blocking that JavaScript file, but I know what it is and I really, really want it.

Outlook doesn’t allow you to unblock unsafe attachments. Fortunately, there is a way to obtain the file and prevent the embarrassment of requesting a renamed version. Before we start…

tip: BIG REGISTRY WARNING!

We’re about to delve into the Windows registry. Please move along if you don’t know what the registry is or have never dabbled with it before. It’s a dangerous place — once false move and your PC will explode.

The fix will also reduce Outlook security settings. That’s not a problem for someone with reasonable IT knowledge, but it’s not for everyone.

Still here? OK, here’s what you do:

1. Close Outlook

2. Run regedit.exe
Navigate to:

HKEY_CURRENT_USERSoftwareMicrosoftOfficeXX.XOutlookSecurity

Where XX.X indicates your version of Outlook:

  • 14.0 for Microsoft Office 2010
  • 12.0 for Microsoft Office 2007
  • 11.0 for Microsoft Office 2003
  • 10.0 for Microsoft Office 2002
  • 9.0 for Microsoft Office 2000

3. Create a new value
Create a new string value key in that location named:

Level1Remove

4. Choose your ‘safe’ file types
Edit the key and enter a list of attachment extensions you want to unblock. Each should start with a period and be separated with a semi-colon. For example…

To unblock JavaScript files only, enter:

.js

To unblock JavaScript, VBScript, and exe files, enter:

.js;.vbs;.exe

Click OK to save the value then exit regedit.

5. Restart Outlook
The attachment should be magically unblocked. Try rebooting if that’s not the case.

Modifying Config.esriaddinx - change add-in's icon

https://geonet.esri.com/thread/23803

PROBLEM
I have an image logo.png stored in both Resources and Images folder in my VB.NET project. However, this image is somehow not visible for the add-in. I've checked the add-in package (.esriAddIn zip file) after compiling the project and there is no image "logo.png" in the Images folder inside this package.

The question is: how can I include this image to my add in package?

SOLUTION
You need to inform the build process to include the image file in the Add-In package.
In Visual Studio's solution explorer, select your logo.png file under images. Set the Build Action property to AddInContent.

Edge Can’t be Opened Using the Built-in Administrator Account

From: http://windowsitpro.com/windows-server-2016/q-edge-can-t-be-opened-using-built-administrator-account

Q: I recently installed the Windows Server 2016 Tech Preview and when I went to use the new Edge browser to go the Internet I got the following message. “Microsoft Edge can’t be opened using the Built-in Administrator account. Sign in with a different account and try again.” Does Edge now have something like Internet Explorer’s Enhanced Security? This is a test system and I don’t want to bother making multiple accounts. How can I get my Windows Server 2016 test system connected to the Internet when I’m running as Administrator?

A: Fortunately Edge doesn’t have anything like the annoying Internet Explorer Enhanced Security. However, Microsoft has made Edge more like a true app and they have enhanced its security to restrict browsing for highly privileged accounts like the local administrator. There are a couple of workarounds. The simplest is just to use Internet Explorer (IE). IE is still present in Windows Server 2016 and you can start it by opening the Start menu and clicking on the Internet Explorer tile. IE security is still controlled by Internet Explorer Enhanced Security and it won’t display that error message.

Alternatively, if you want to use Edge you can change to the local security policies to allow Edge to run under the Administrator’s account. Use the search option in the taskbar and enter secpol.msc then click on it in the search results. Under Local Policies, Security Options navigate to User Account Control Admin Approval Mode for the Built-in Administrator account click on it to open the properties. Set the policy to Enabled and click Apply. After you reboot the system you will be able to use Edge under the local Administrator account.

Filtering or Sorting columns causes message: enter parameter value .fileURL

In Access 2010 I recently got an error when sorting a column or opening a Form that had a sorted column. It was a popup like you would see when you had a missing parameter in a query. It read qryQuery,FieldName.FileUrl and a place to enter the value. It had me stumped so I opened the form in design and removed any sorting. I was then able to open the form OK, but when I clicked on the first column to sort it gave me this error. BTW it was a Split Form with the Datagrid on the bottom and only the Form section on top was editable.

I did a manual Compact and Repair and the then the issue disappeared. Funnily enough this also happened in the compiled ACCDE. So to fix the ACCDE I just did a manual Compact and Repair ACCDB and THEN made the ACCDE. Then it worked fine.

I hope this helps someone else out there one day!

SSIS Convert Between Unicode and Non-Unicode Error with LARGE Field

PROBLEM: I have been struggling with this error now for days now and have tried everything I know. I have an SQL statement that pulls data from several tables into another table. The field in question is a NTEXT field from a SQL 2000 database, which I now import into a SQL 2008 R2 table that is NVARCHAR(MAX) data type because I though the issue was the NTEXT data type. However the SSIS package that is just an OLE DB Source (with 1 field) into an Excel Destination is still giving me the Unicode and Non-Unicode Error!! Several rows of data are over 8000 characters in length.

ANSWER: After a lot of pain I finally came to the conclusion that Exporting to EXCEL is not possible so I turned to CSV. I used "Flat File Destination" object, pointed to a CSV that I had created with just the Headers. The Text Qualifier was set to double quotes. In the Columns section I set the Row delimiter to {CR}{LF} and the Column delimiter to Comma{,} because it is a CSV! The final part of the puzzle was to remove and double quotes, Carriage Returns and Line Feeds. I also had to convert the NTEXT field to VARCHAR(MAX) because REPLACE will not work with NTEXT. This is what I ended up with for the columns that had these "invalid characters".

REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(MAX),[MyNTEXTColumn]), CHAR(13),' '), '"', ''), CHAR(10),'') AS 'Corrected Output'

I replaced {CR} CHAR(13) with a space to that we could have it formatted well for the consumer. I hope this helps someone out one day.

Column name Create Date contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault.

To resolve the invalid chracter from FOR XML PATH clause

Background
I have a stored procedure which returns data as an XML node. This stored procedure uses temp table to populate data. The column names in the temp table contain spaces, i.e. [Create Date].

Error
"Column name Create Date contains an invalid XML identifier as required by FOR XML; ' '(0x0020) is the first character at fault."

Resolution
After removing spaces from the column names, this error was resolved.

Thanks to: http://www.codeproject.com/Tips/142869/Column-name-Create-Date-contains-an-invalid-XML-i