[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Type Statement variable names

Posted on 2005-04-20
5
Medium Priority
?
148 Views
Last Modified: 2010-05-02
I am upgrading an existing MS-Access application to VB
I have several different record types and my thoughs were to setup each record with a type statement.  I have the following questions:  
1.  Do the variable names in the Type Statement have to be the same as they are in the file?  For example, if the MDB file the field name is "Case Number", do the field name in the TYpe statement also have to be "Case Number"?  
2.  If the answer to question number 1 is correct, how do you code the field name within the type statement?  When I use "Case Number" I receive a compiler error.  When I use [Case Number], I receive a compiler error?  
0
Comment
Question by:WLoftus
  • 3
  • 2
5 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 13827617
>setup each record with a type statement

Your meaning is not clear to me here.  If you mean to create a user defined type for each record, then you should be able to do that without any difficulty.

> Do the variable names in the Type Statement have to be the same as they are in the file?

If I understand your meaning as above, then no you don't.

>2.  If the answer to question number 1 is correct, how do you code the field name within the type statement?  When I use "Case Number" I receive a compiler error.  When I use [Case Number], I receive a compiler error?  

The variables defined in a type statement are subject to visual basic naming limitations.  Any variable name cannot have spaces.  The logical alternative would be Case_Number or CaseNumber.  Case is a reserved word in VB....  

See Code Basics in MSDN for other naming limitations.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconcodebasics.asp
0
 

Author Comment

by:WLoftus
ID: 13827802
Private Type ATM   ' declaration of record type
     Case Number as String
     First Name as String
     Middle Name as String
     Last Name as String
End Type

An example of what I was trying to say.  
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 13828038
No problem, just take out the spaces:

 Private Type ATM   ' declaration of record type
     CaseNumber as String
     FirstName as String
     MiddleName as String
     LastName as String
End Type
0
 

Author Comment

by:WLoftus
ID: 14277081
The resolution provided was part of my question.  Close item.  
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 100 total points
ID: 14277290
> The resolution provided was part of my question.  Close item.
Your question had two parts, both of which were addressed in my first comment.  I believe that I answered your question correctly and completely and I provided extra information in the form of a link to visual basic naming conventions...

You can close an item by accepting a comment as an answer.  Your other options are here:
http://www.experts-exchange.com/help.jsp#hs5
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Suggested Courses

872 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