Friday, December 28, 2012

We Accept Bitcoins

We've started accepting payments in Bitcoins at our site. If you haven't heard of Bitcoin, it is a new digital currency that uses encryption to keep transactions safe over a distributed network. You can covert some money to Bitcoins, then use them as currency where they are accepted. There are some advantages and disadvantages to using Bitcoins, and lots of controversy including some very interesting discussions of whether Bitcoins qualify as actual "money" or not:

Bitcoins Real Money or Bogus?

But one of the amazing things about Bitcoin for me is how secure payments are. You don't need to provide your name, address, phone, card number, security code, etc... as you do when you pay with a credit card. Bitcoins are designed to be used over the internet. You pay, and your "wallet" cryptic keys are identified by the distributed network and your account is credited or debited, and the recipient's account is credited or debited. No worries about someone stealing your credit card number or your identity. You just have to make sure your "wallet.dat" file doesn't get hacked, and you can do that with encryption or by some other similar means.

Is it the future of money? We'll see. For now it's a nice secure alternative to credit card payments.

Thursday, November 8, 2012

GetKeyState

You can use the GetKeyState API to find out if the user is holding down a particular key. http://msdn.microsoft.com/en-us/library/windows/desktop/ms646301(v=vs.85).aspx I've used this function to take me directly into the VBA code behind a command button while a form is in form view. This is very hand for debugging, but takes some setup. I check for the Ctl-Alt key combination in the OnMouseUp event property of the command button. My OnMouseUp event property looks like this:
=xg_CtrlAltMouseUp()
In the declarations section of a standard module I put:
Const VK_LSHIFT = &HA0
Const VK_RSHIFT = &HA1
Const VK_LCONTROL = &HA2
Const VK_RCONTROL = &HA3
Const VK_LMENU = &HA4
Const VK_RMENU = &HA5
 
#If vba7 Then
    Declare PtrSafe Function GetKeyState Lib "user32" Alias "GetKeyState" (ByVal nVirtKey As Long) As Integer
#Else
    Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
#End If
And the function looks like this:
Function xg_CtrlAltMouseUp() As Integer
'******************************************************************************
'* Peter De Baets, author
'* 11/2/2012
'*
'******************************************************************************
Dim Marker As Integer
Dim Rtn As Integer

On Error GoTo Err_Section
Marker = 1

'Return values
'0 if the key is neither down nor toggled,
'-127 if the key is down but not toggled,
'1 if the key is toggled but up, and
'-128 if the key is both toggled and down.
If GetKeyState(VK_LCONTROL) < 0 And GetKeyState(VK_LMENU) < 0 Then
    DoCmd.OpenModule "Form_" & Screen.ActiveForm.Name, _
        Screen.ActiveControl.Name & "_Click"

Else
End If

Exit_Section:
    On Error Resume Next
    On Error GoTo 0
    Exit Function
Err_Section:
    Select Case Err
    Case Else
        Beep
        MsgBox "Error in xg_CtrlAltMouseUp (" & Marker & "), _
        object " & Err.Source & ": " & Err.Number & _
        " - " & Err.Description
    End Select
    Err.Clear
    Resume Exit_Section
End Function

Access 2010: Replacing 32-bit API declarations with 64-bit

Here's a site which lists all the 64-bit API declarations for use in your Access 2010 64-bit application: http://www.excelfin.ru/attachments/article/163/ptrsafe_declarations.txt

Friday, January 6, 2012

Introduction to Access Programming

I get a lot of questions from people who are new to Access development and have never programmed before. Here's an introduction to the subject:

Introduction to Access Programming

(Disclaimer: Please realize that getting involved in programming can be life-changing - not necessarily for the better!)