Solved

Easy One _Unfortunately Not For Me

Posted on 2000-03-17
9
163 Views
Last Modified: 2010-05-02
Hi,
I Adopted a project and the code of someone who cannot help me, that appears to keep track of the contents of a textbox.
-----------------------
If (txtMentors.Text = "") Then
 MsgBox "The Mentors field is left blank"
 FieldTrack% = 1
End If
-----------------------

I cannot figure out this use of a % in a variable name. I tried declaring:
--------------------------
Dim FieldTrack% as Integer
--------------------------

, that is not working. What is the % all about. Thanks.

diek
 
0
Comment
Question by:diek_nf
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Accepted Solution

by:
prozak earned 3 total points
ID: 2627978
% is a way to tell VB that the variable is of type integer (you can do the same thing with a $ to be a string). This is a hold over from BASIC. You can remove the % sign and not worry about it.

Dim FieldTrack As Integer

FieldTrack = 1

That should work fine.
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2627984
The % is simply a declaration character stating the FieldTrack is an integer variable.

Personally I avoid using such symbols :

Dim FieldTrack as Integer

and remove the % from
FieldTrack% = 1
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2627987
Sorry prozak... your answer appeared as I was typing.
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2627989
the % says that the variable is an integer... You use the % if you're not going to declare the variable using the "Dim" statement.

If you are going to use the "Dim" statement, don't use the %

For example:

   Dim FieldTrack as Integer

Then anywhere in the sub where you reference "FieldTrack%", change it to "FieldTrack"


Cheers!®©
0
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.

 
LVL 1

Expert Comment

by:prozak
ID: 2628005
That's OK paul, I see I was only 1 minute ahead of you :)
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2628009
paulstamp changed the proposed answer to a comment
0
 

Author Comment

by:diek_nf
ID: 2628058
prozak,
I feel like a bit of a dummy but what the hell. That works perfectly.
diek
0
 

Author Comment

by:diek_nf
ID: 2628067
Sorry,
I was a bit quick. Thank you to everyone who replied, and darn speedy to boot. Have a good day of programming.
diek
0
 
LVL 1

Expert Comment

by:prozak
ID: 2628097
Nobody is a dummy here...
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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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

22 Experts available now in Live!

Get 1:1 Help Now