views:

72

answers:

7

Hey I am a university student (math major), but programming since I was little (read: 14). I am starting a new programming job tomorrow at a very big company.

However I just found out that I might be just working with access for a couple of weeks (macros and whatnot).

Can someone just give me a general rundown on how to create and use VB in access. What I mean is how do tables refer to themselves (as objects? as what name?) how to run queries through vb and such.

thanks all.

+2  A: 

Probably the best thing you can do is take a look at what they already have and how they already do it. This way any bad habits you pick up from inexperience with the platform will at least conform to the company's current standards.

Joel Coehoorn
I understand, but what if at my first day (tomorrow) they ask me to write something quickly?
masfenix
I've never had a first day ask me to write something quickly in a new language that it wasn't going to be simple. If you've any familiarity with MS Visual Studio and Intellisense then you'll be able to work with Access, more or less.
drachenstern
+2  A: 

You would use VBA (Visual basic for Applications)...Here is a Link

kishore
marked as answer because it was exactly what I needed.
masfenix
+2  A: 

If you are working with MS Access, do yourself a favour and get a copy of the Litwin and Getz book.

Mitch Wheat
+3  A: 

Do yourself a favor and get the following book:

Access 2002 Desktop Developer's Handbook
http://www.amazon.com/Access-2002-Desktop-Developers-Handbook/dp/0782140092

Although it appears dated, it's still the definitive reference for developing professional applications in Access. You don't have to read the whole thing; think of it as a cookbook of solutions.

There's really no "short introduction" to Access. If you are building applications with it, there are a few good ways to do it right, and a whole bunch of bad ways to do it wrong. This book will keep you in the corridor with the good ways.

The companion book is:

Access 2002 Enterprise Developer's Handbook
http://www.amazon.com/Access-2002-Enterprise-Developers-Handbook/dp/0782140106

Which you should get if the applications you are developing will be multi-user.

Robert Harvey
A: 

Depending on experience with Access and version of Access to be used, Matthew MacDonalds's "Access 2007: The Missing Manual" may be worth considering; includes chapters on automating tasks with macros and also with VB.

feldspar
+1  A: 

In your time out of work, install Access, and try using it as an end user, not a programmer. Try all the point-and-click tools for creating tables, queries, forms, reports, etc. It's only when you are fully familiar with those tools that VBA coding will make any real sense. Ignore macros if you're not working with Access 2010.

ADDED:

If SQL Server as a back end is available or desirable, you might also want to pick up Baron and Chipman's book about SQL Server for Access Developers.

David-W-Fenton
+1  A: 

Add a reference to the DAO and then you can make Recordset and Connection Objects to query (with sql statements or stored procedures) and manipulate the data. When you make forms, simply pull up the properties and go to the events. This will take you to the code editor (VBA) that will let you program and use those recordset and connection objects I just typed about above.

DaMartyr
DAO does not have a connection object, but ADO does. All versions of Access have a default reference either to DAO or ADO. The only version that defaults to ADO-only is A2000, and I wouldn't be using A2000 at this late date by choice. DAO is by far the more sensible data interface in Access.
David-W-Fenton
Good point on the connection object, it is simplified to just a database and recordset objects. Masfenix, from your Visual Basic (for applications) Editor select Tools->Refrences from the menu and Add the Microsoft DAO X.X Object Library. After that put in something similar to below. Dim DB As Database Dim RS As Recordset Set DB = OpenDatabase("\\Path_To\DB.mdb") Set RS = TSIDB.OpenRecordset(SQLStatement) Do While RS.EOF = False Msgbox(RS.Fields("Some_Field_Name")) 'Or whatever else you need to do TSIRS.MoveNext Loop RS.Close DB.Close
DaMartyr