Solved

Ampersand sign behind number

Posted on 2011-09-05
12
588 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
 
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

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.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

937 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now