Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA, VB and SQL Defined Please 1

Status
Not open for further replies.

Linda354

Technical User
Jan 2, 2002
59
US
I'm somewhat functional with Access now, and ready to start tackling programming, but I'm confused. This may be a dumb questions, but what is the difference between VBA and SQL? It seems I've been tripping over both interchangeably.

There are courses nearby in Visual Basic. How readily will that apply to the VBA I need for Access?
 
Visual Basic for Applications (VBA is a programming language that a variant of the Visual Basic language). VBA is used in modules throughout Access to give added functionality. Certain objects, such as Command Buttons and the like, run VBA to perform their tasks.

Structured Query Language (SQL) is an entirely separate language. This language is used to structure queries. Whe you use the Access Query Grid to design a query, the SQL that actually runs that query is constructed in the background by the Query Builder. While VBA is a variant of Basic that is used only in MS Office applications, SQL (in various flavors) is used among numerous databases on varying platforms.

It is easy to understand how VBA and SQL can "run together." Both languages can be used in Access modules, sometimes in the same Function or Sub. Nonetheless, they are distinct.

As to a Visual Basic course . . . . a lot of VBA is similar to Visual Basic . . . but a lot is not. A Visual Basic course will focus on building an entire application with Visual Basic, while VBA is used to enhance Access. While you probably couldn't go wrong taking a VB course, I'd recommend trying to find a VBA course. If you do wind up taking the VB course, keep in mind that some things you learn there will not work in Access. - - - -

Bryan
 
When I use the "Build" function, is that VBA? And you're saying when I work with queries, SQL is involved. Okay.

Is it just a portion of SQL that's being used by Access? I looked for texts on SQL at Barnes & Nobles and didn't find anything. I see want ads for employers looking for people who know it, but it seems sort of invisible otherwise.

I have a book on Access 2000 programming that's been fairly accesible so far, by Prague, Reardon, Kasevich and Phan. Maybe I should just stick with that.

If I become functional with the VBA and SQL utilized by Access, will I be able to claim in the job market that I know SQL, and how versed in VB will I be if I just know Access's utlization of VBA?
 
Hi!

The main thing you need to remember about SQL is that the language is designed to manipulate data and to limit the data returned for the user to see. If you know SQL as used in Access then I would say that you can go ahead and claim SQL knowledge, with the caveat that you don't fool yourself. Remember that Access SQL, like VBA, isn't complete, but SQL as used in different DM programs tend to be a little different from program to program. Most changes you should be able to work out with your Access knowledge and a decent book about the Db manager your are using. If you know VBA, you have a head start on VB, but you won't know everything about it. Of course, that goes the other way too. I can always tell an Access database that was programmed by a VB user that is just starting in Access. The two languages are very similar, but are different especially in how they handle controls. Still, as I said, knowing VBA will give you a considerable head start.

hth
Jeff Bridgham
bridgham@purdue.edu
 
An example might help

If you open a Recordset in Access ( using ADO in this case )

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.Open "SELECT field1, field2, field6, " _
& "FROM tblTable1, tblTable6 " _
& "ON tblTable1.field2 = tblTable6.field6 " _
& "WHERE tblTable6.field7 > 42 " _
& "AND tblTable6.field8 " _
& "BETWEEN 47 AND 50 " _
& "ORDER BY tblTable1.field3 ;
"

While Not rst.EOF
Debug Print rst!field1
Debug Print rst!field2
Debug Print rst!field6
rst.MoveNext
Wend
rst.Close
Set rst = Nothing



All of the above is VBA and will work in Access
Having said that, then it implies that it is all VB and it WILL work in VB6 as well.

The stuff in bold is SQL
And if you we're working in a SequelServer database, Orical database or ASP on a web server you could use the same construct.

The PROBLEM you'll come up against if you go out to the market to offer your skills is that Agencies know less about the differences than you did when you started this thread.
SQL is used to mean SequelServer and vice-versa.
VB is used to mean VB6 or VB.net and vice-versa.
VB us used when VBA should be used and vice-versa
There is also a great difference in the work of a DBA compared to the work of a DBA . ( As in a DataBase Analyst as compared to a DataBase Administrator )
Analysts Design and Develop
Administrators sort out other people's passwords and remember to do the backup at the end of the day etc



I hope I haven't added to your confusion -

G LS
 
No, you haven't added to my confusion at all, I have a sense of it now. I guess the thing I'm still wondering is, why couldn't I find a text on SQL at Barnes & Nobles? It makes me think it's not a competitive skill to be acquiring. In general, how is Access holding out against the competition? And if I master this one, how readily will it transfer to other applications, like Oracle?

 
I just searched Barnes and Noble for 'sql' and the query returned 250 titles. Not all are relevant to Access SQL, but a number are.

Maybe go find another Barnes and Noble? - - - -

Bryan
 
Or maybe I was just looking in the wrong pew.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top