Solved

Easy One _Unfortunately Not For Me

Posted on 2000-03-17
9
162 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
Comment Utility
% 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
Comment Utility
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
Comment Utility
Sorry prozak... your answer appeared as I was typing.
0
 
LVL 14

Expert Comment

by:mcrider
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Expert Comment

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

Expert Comment

by:paulstamp
Comment Utility
paulstamp changed the proposed answer to a comment
0
 

Author Comment

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

Author Comment

by:diek_nf
Comment Utility
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
Comment Utility
Nobody is a dummy here...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 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

10 Experts available now in Live!

Get 1:1 Help Now