Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / February 2005

Tip: Looking for answers? Try searching our database.

Counter for Bit / Flag

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lyle Fairfield - 19 Feb 2005 13:11 GMT
Option Explicit
Dim b As Byte

Private Sub test()
   Dim z As Long
   Use 5
   Use 6
   Use 6
   For z = 0 To 7
       Debug.Print z, Used(z)
   Next z
End Sub

Public Sub Use(ByVal n As Long)
   b = b Or 2 ^ n
End Sub
   
Public Function Used(ByVal n As Long) As Boolean
   Used = b And 2 ^ n
End Function

The function Used() tells us which numbers have been used.
How would you keep track of the number of times they have been used (in the
sample 5->1, 6->2)?

Signature

Lyle
--

Bob Quintal - 19 Feb 2005 13:56 GMT
> Option Explicit
> Dim b As Byte
[quoted text clipped - 20 lines]
> How would you keep track of the number of times they have been
> used (in the sample 5->1, 6->2)?

declare a public array of int in test, increment the applicable
subscript in used.

Signature

Bob Quintal

PA is y I've altered my email address.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.