Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Easy One _Unfortunately Not For Me

Posted on 2000-03-17
9
Medium Priority
?
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Accepted Solution

by:
prozak earned 12 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

715 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