VB, VBA, VB.NET, and VBScript all belong to the same general Visual Basic family, and their syntax can look similar enough to cause trouble. The problem is that similar-looking code does not necessarily run in the same place, use the same objects, or even have access to the same libraries.
If you are looking for programming help, the first question should not be, “Which version is newest?” It should be, “Where is this code supposed to run?”
If you are programming inside Microsoft Access, you are learning VBA: Visual Basic for Applications. That matters because a VB.NET example, a VBScript file, or an old Visual Basic 6 project may look familiar while being completely inappropriate for an Access database.
Classic Visual Basic and VB6
When people say “classic Visual Basic,” they usually mean Visual Basic 6, often called VB6. It was a popular Windows development environment with a visual form designer. You could drop controls onto a form, double-click a button, and write code for its Click event.
That should sound familiar to Access developers. Access forms and VB6 forms share the same general event-driven approach. You create a user interface, add controls, and write code that responds when users click buttons, enter data, move between records, and so on.
The important distinction is that VB6 was used to create standalone Windows applications outside of Access. A VB6 form was not an Access form. A VB6 project did not require the Access environment to run.
VB6 is old technology now. Microsoft ended support for the VB6 development environment in 2008. That does not mean every existing VB6 application suddenly stopped working. Microsoft still supports the core VB6 runtime on supported Windows versions, with limited servicing. Plenty of organizations still maintain old VB6 programs.
If you inherit an old application described as “Visual Basic,” find out which Visual Basic it is. A VB6 project is very different from a modern VB.NET project, even though both may contain forms, buttons, and code that looks somewhat alike.
VBA: Visual Basic for Applications
VBA is the language used inside Microsoft Office applications. In Microsoft Access, VBA is what you write behind a button, in a form event, inside a report, or in a standard module.
VBA is not a standalone application-development environment. It runs inside a host application, and that host provides the objects your code works with.
In Access, those objects include things like:
Forms
Reports
Tables
Queries
Recordsets
Controls
Database objects
In Excel, VBA works with a different object model:
Workbooks
Worksheets
Cells
Ranges
Charts
Word, PowerPoint, and Outlook also support VBA and provide their own application-specific objects.
This is why you have to be careful when searching for code examples. An Excel VBA example that manipulates a worksheet may be perfectly valid VBA, but it will not automatically work in Access. Access does not have Excel worksheets. You may be able to adapt the logic, but you need to understand which application’s objects the code uses.
VBA is especially useful because it extends the application you have already built. You are not starting from scratch every time you need a button, a form, a report, or a database connection. In Access, you can build substantial business applications using forms, reports, queries, tables, macros, and VBA together.
But VBA depends on its host application. Access VBA needs Access. Excel VBA needs Excel. That is one of the big differences between VBA and the other Visual Basic family members.
Get Richard Rost’s stories in your inbox
Join Medium for free to get updates from this writer.
VB.NET: Modern Visual Basic for .NET
VB.NET is the modern .NET version of Visual Basic. Microsoft often refers to it simply as Visual Basic now, which does not make this naming situation any less confusing.
The “.NET” part is important. VB.NET is designed for the .NET platform and uses .NET libraries. You generally use a development environment such as Visual Studio to create applications, libraries, and other .NET projects.
You can still build Windows applications with forms, buttons, text boxes, and other familiar controls. Windows Forms, for example, can feel visually similar to VB6 or Access at first glance.
However, VB.NET is not VB6 with a newer coat of paint. The project structure, runtime, libraries, and development environment are all different. You cannot assume that an old VB6 application will open and run as a VB.NET project. Likewise, you cannot take an Access VBA procedure, paste it into a VB.NET application, and expect it to work without changes.
The languages share history and some familiar syntax, but the platform matters. A procedure that uses Access objects such as Form, Report, or CurrentDb belongs in Access VBA. A .NET project uses .NET classes and libraries instead.
Modern Visual Basic is still supported and remains a valid option for .NET development.
VBScript: The Scripting Member of the Family
VBScript is another related language, but it has a very different role. A VBScript file usually has the .vbs extension and is a plain text file that runs through a script host such as WScript or CScript.
Historically, VBScript was useful for small automation jobs and for working with COM objects. It was also used in older web environments, including Classic ASP.
There is no one required VBScript editor. You can write a VBS file in Notepad if you want to. That simplicity made it useful for lightweight scripts, but it does not make VBScript the same thing as VBA or VB.NET.
VBScript requires a host to run it. VBA also requires a host, but the hosts are different. VBA runs inside Office applications such as Access or Excel. VBScript runs through Windows scripting hosts or other environments that support it.
Microsoft has deprecated VBScript and is phasing it out of Windows. That does not mean it has already vanished from every computer. Its availability depends on the Windows version, system configuration, and Microsoft’s rollout stages.
If you maintain old VBS files, identify what runs them and make plans for the future. Microsoft has indicated that VBScript will remain available for the near future, though it may not be installed by default. On newer machines, you may need to install it manually.
Can You Reuse Code Between Them?
Sometimes, yes. Often, not directly.
The basic language syntax can be similar. You may recognize If statements, loops, variables, procedures, and other common programming ideas across VB6, VBA, VB.NET, and VBScript.
But the objects, runtime, libraries, project files, and deployment methods are different.
For example, an Access VBA routine may depend on Access-specific objects such as forms, reports, recordsets, or the CurrentDb function. That code belongs in Access. An Excel VBA example may depend on worksheets and ranges. A VB.NET example may use .NET libraries that do not exist in VBA. A VBScript example may rely on WScript, CScript, or COM automation.
Recognizing familiar syntax can help you understand the general idea behind a piece of code. It does not mean you can copy and paste it into another Visual Basic environment without changes.
The Practical Rule: Start With the Environment
When searching for help, include the platform in your search.
If you are writing code in a Microsoft Access database, search for Access VBA examples.
If you are working with Excel, search for Excel VBA examples.
If you are maintaining an old Windows application, determine whether it is VB6 and identify any components it depends on.
If you are building a modern .NET application, VB.NET is the relevant branch.
If you inherited .vbs files, those are VBScript files, and they have their own host environment and lifecycle considerations.
The letters “VB” are not enough. The environment where the code runs is what tells you which language, object model, tools, and examples apply to your situation.
If you are new to programming in Microsoft Access, an introductory Access VBA tutorial is a good place to start. It will teach VBA specifically in the context of Access forms, reports, recordsets, and database applications, which is much more useful than trying to force unrelated VB.NET, VB6, or VBScript examples into an Access project.
LLAP / RR
For a complete video tutorial on this topic, please visit https://599cd.com/QQ108







