We help IT Professionals succeed at work.

Making a new instance of ...

250 Views
Last Modified: 2014-03-17
in visual basic one is to make and use what is referred to a 'new instance' of an object. in access we can do the same thing. then we can give that new object properties. as an example: if i make a new employee then give it properties such as fname, lname, bdate, etc. then i believe i have the following: employee.fname, employee.lname, and employee.bdate. apparently this type of object construction is frequent in visual basic. one of the advantages, as i understand it, making changes is easier through out the code. what i am asking in this question is how can i utilize this in access. again i know i can create a new object and the give it properties, but how can i incorporate this into a table and other access objects. is there some teaching on this specific topic.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2010

Commented:
You might also want to review this: https://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/A_3802-Parent-Class-Builder-Add-In-for-Microsoft-Excel.html

It is an add-in I created for Excel that makes it easier to create class modules, especially when you have classes with "parent" and "child" relationship.  For example, in your case you might have a "parent" class clsEmployees, with members of "child" class clsEmployee.

While it is built for Excel, the add-in can export the code as *.cls files, which you can then import into your Access project.
Scott McDaniel (EE MVE )Infotrakker Software
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
If you're referring to Objects in VB.NET, then understand that Access doesn't behave the same as .NET. You can build classes and such that work as the other Experts have described, but the environment in Access does not translate over to the environment in .NET.

With that said - you can do quite a lot with classes and such in Access, and you'll find that working with classes in Access is similar to other environments. Access/VBA doesn't support higher-level class methods like Inheritance and such, but it's rare that you truly need those (and if you do, you probably should be working in .NET anyway).
Jeffrey CoachmanMIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
<If you're referring to Objects in VB.NET, then understand that Access doesn't behave the same as .NET. You can build classes and such that work as the other Experts have described, but the environment in Access does not translate over to the environment in .NET.>

Correct, if you are starting out in the .Net world, then this is the way that might be most common
In MS Access, ...not so much...
I have been building Access app for over 10 years and have only done this a few times.
That is not to say that I could not have used one, ...only that I never had a real need.

Can you state your ultimate goal here in terms of what you are trying to accomplish.
(Not terms of the technology)
because this is unclear:
<if i make a new employee then give it properties such as fname, lname, bdate, etc. then i believe i have the following: employee.fname, employee.lname, and employee.bdate. apparently this type of object construction is frequent in visual basic.>
...I am not so sure I understand the context here...
If you want to creates a new employee (In MS Access), this is typically done as a "Record", not as an instance/class.

Since you posted this Q to both the MS Access and .Net Topic areas, you need to tell us what parts of this Q relate to MS Access and what parts pertain to .net.

JeffCoachman
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.