Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VBA Code, what's the "&" about in a variable declaration?

Options
  • 12-01-2012 11:53am
    #1
    Registered Users Posts: 3,411 ✭✭✭


    Hi folks,

    Believe it or not, this is my own code from years ago. I'm trying to figure out what I was doing with the variable c& ? What is the ampersand about? Is it a pointer or something?
    Public Function HasExistingLoan(CustomerID As Integer) As Boolean
    
    On Error GoTo errHand
    
    [B]Dim sql As String, c&
    [/B]
    sql = "SELECT COUNT(customer_id) " & _
            "FROM loans " & _
            "WHERE customer_id =" & CustomerID & _
            " AND end_time Is Null AND end_station Is Null"
    
    c = CurrentProject.Connection.Execute(sql).Collect(0)
    HasExistingLoan = (CInt(c) > 0)
    
    Exit Function
    
    errHand:
    HasExistingLoan = -1
    
    End Function
    


Comments

  • Registered Users Posts: 3,411 ✭✭✭dnme


    To answer my own question, I think it forces a type of "long" rather than 16bit int to the variable c. If true it's just shorthand and I don't know why I didn't use "Dim c as long" instead for readibility. Am I on the right track?


  • Registered Users Posts: 2,149 ✭✭✭dazberry


    dnme wrote: »
    Am I on the right track?

    It would appear so:

    http://msdn.microsoft.com/en-us/library/s9cz43ek.aspx

    D.


Advertisement