Solved

Ampersand sign behind number

Posted on 2011-09-05
12
603 Views
Last Modified: 2012-05-12
Hi there,

On a site I found a nice piece of code to change the cursor from an arrow to a hand while moving over the button. (http://www.access-programmers.co.uk/forums/archive/index.php/t-15232.html)

What puzzles me is what the Ampersand character (&) is doing behind the numbers.

An example: Public Const IDC_HAND = 32649&

Why is this sign there? What's the use?

An explanation is welcome.

Nico.
0
Comment
Question by:Nico_W
12 Comments
 
LVL 75
ID: 36485188
For any Control that has a Hyperlink Address, if you type just a single Space, this will make the hand appear ...

mx
Capture1.gif
Capture2.gif
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36485198
What puzzles me is what the empercent-sign (&) is doing behind the numbers.

The correct word is ampersand :)
0
 
LVL 75
ID: 36485206
OR ... you can use this code, which is what I use:

Option Compare Database
Option Explicit

   'This code for Cursors was originally written by Terry Kreft.
   'Also, SSF_DsplyMouseCursor and SSF_DsplyIcon (both modified by ADI)
   
    Declare Function adiSWA_LoadCursorByNum Lib "user32" Alias "LoadCursorA" _
      (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
   
    Declare Function adiSWA_LoadCursorFromFile Lib "user32" Alias _
      "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
   
    Declare Function adiSWA_adiSetCursor Lib "user32" Alias "SetCursor" _
      (ByVal hCursor As Long) As Long

Function SSF_DsplyMouseCursor(sCursorType As String) As Boolean

'---------------------------------------------
' Action(s)       : Changes the mouse cursor to the type indicated by sCursorType.
' Comments        : Typically called from an object's MouseMove event
' Protocol        : =SSF_DsplyMouseCursor("Hand")
'---------------------------
' Argument     Description
' --------     -----------
' sCursorType  Cursor type desired, as specified below
        'Hand
        'AppStarting
        'No
        'Wait
        'Arrow
        'Cross
        'SizeAll
        'SizeNESW
        'SizeNS
        'SizeNWSE
        'SizeWE
        'UpArrow
'---------------------------
 
    Dim sCursors As String
    Dim iCursorPos As Integer
    Dim lCursorType As Long
   
    sCursors = "Hand32649AppStarting32650No32648Wait32514Arrow32512Cross32515SizeAll32646SizeNESW32643SizeNS32645SizeNWSE32642SizeWE32644UpArrow32516"
    iCursorPos = InStr(1, sCursors, sCursorType)
    lCursorType = Mid(sCursors, iCursorPos + Len(sCursorType), 5)
    Call adiSWA_adiSetCursor(adiSWA_LoadCursorByNum(0&, lCursorType))

End Function


Then, call this Function from the MouseMove event of any Control you want the Hand - see Image.

mx

Capture1.gif
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 44

Expert Comment

by:GRayL
ID: 36485373
& is the VBA character representing the Long datatype
0
 
LVL 44

Accepted Solution

by:
GRayL earned 125 total points
ID: 36485377
To state it more precisely, the type-declaration character for Long is the ampersand (&).
0
 
LVL 44

Expert Comment

by:GRayL
ID: 36485444
% is the type-declaration character for Integer which has values from -32768 to 32767

In the Immediate Pane I typed two multiplication and took a snapshot after the error message from the second multiplication The error message
0
 
LVL 75
ID: 36485456
Nico ... do it the one of two easy ways I posted.  I've been using those for years and they work.

mx
0
 
LVL 45

Expert Comment

by:aikimark
ID: 36485506
The character suffixes have fallen out of use and should be explicitly defined or cast

Public Const IDC_HAND As Long = 32649

x = CLng(32649)

Open in new window

0
 
LVL 75
ID: 36485515
@ http:#a36485206  - the simplified version that works    :-)
0
 
LVL 44

Expert Comment

by:GRayL
ID: 36485567
http:#a36485377 - answers the question ;-)
0
 

Author Closing Comment

by:Nico_W
ID: 36486478
All,

Great to see the enthusiasm with which this question was taken on.

To Papertrip and Aikimark: thanks for correcting me on the correct name of the sign. That's probably why I couldn't find an answer to the question on Google :-)

GRayL: Although DatabaseMX definitely gave the most extensive answers, I have to agree with you that you gave the answer to the question. Therefore, I will accept your solution.

DatabaseMX: the code on the page that I was referring to also originates from Terry Kreft. I will compare the two versions to see the differences. Anyway, I learned some new things from your posts. For instance, the comment on the hyperlinks is something that I was not aware of. In the business environment I am currently working in, they are still using Access 2003. Not sure if this option is already present there.

All,

Thanks very much for your answers.

Nico.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question