"SELECT COUNT(Polisnr) AS xx1, " _
& "SUM(Premie*Termijnbet) AS yy1, " _
& "SUM(inkomen*termijnbet) AS zz1 " _
& "FROM Polissen, Branche WHERE Polissen.Branche=Branche.Branche
AND Branche.Soort='700' " _
& "UNION SELECT COUNT(Polisnr) AS xx1, " _
& "SUM(Premie*Termijnbet) AS yy1, " _
& "SUM(inkomen*termijnbet) AS zz1 " _
& "FROM pakketPolis, Branche WHERE
pakketPolis.Branche=Branche.Branche AND Branche.Soort='700'"
Eric De Decker
vbg.be@vbgroup.nl
What you do is create a fixed-length string the size of the largest data element you plan to hold in the union. You then use the CopyMemory function to copy into/outof that variable.
[tt]
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
[/tt]
Example:
[tt]
Dim sStore as string * 10
Dim lValue as long
The same can be done with other datatypes, user-defined structures, etc. But not classes or other objects.
The most important thing here is to keep an eye on the length of things. Be sure to allocate enough space to store everything, and make sure that the length parameter to the CopyMemory call is correct. If you forget, you get a visit from Dr. Watson.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.