Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

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

I would recommend disabling the iCloud Outlook Add-in by going to File > Options > Add-Ins, and then going into "COM Add-ins" to uncheck that item and disable it.  


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…


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:


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:


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:


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


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.


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?

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.

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.

This is a brilliant service! It's not 100% perfect but pretty cool and saved me hours on manually typing!



    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
    dbid > 0
    dbid, loginame

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!

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.

To resolve the invalid chracter from FOR XML PATH clause

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].

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

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

The Blogger

Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca


<<  March 2017  >>

View posts in large calendar

Sign in