Solved

Creating an incramental counter

Posted on 1999-01-19
4
144 Views
Last Modified: 2010-05-03
I need to create a counter that will count in incraments of 1 every time I click a command button, and display the number on a label on the same form.  Any suggestions would be mucho appreciated.
0
Comment
Question by:agenda
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1469439
put this in Form_Load

Command1.tag = 0

PRIVATE Command1_Click()
count = val(command1.tag)
count = count + 1
command1.tag = count
label1.caption = count
END SUB


0
 

Author Comment

by:agenda
ID: 1469440
This did not work, it say's cannot assign to a read only property.  I tried it in the form_load and the command button.  but it has not worked
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1469441
Oops! COUNT is a reserved word. Change it to CNT and it'll work.

M

0
 
LVL 1

Expert Comment

by:Johnn
ID: 1469442
Email me if you want a cool odometer control

jnickle@shaw.wave.ca
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

20 Experts available now in Live!

Get 1:1 Help Now