Solved

Ampersand sign behind number

Posted on 2011-09-05
12
575 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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
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

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.

Join & Write a Comment

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

708 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

13 Experts available now in Live!

Get 1:1 Help Now