I’m looking to write a little program in VB2008 that will automate several tasks involving Access and Excel. I’ve done little programming beyond scripts in Matlab, and I’m having a little trouble getting started. The problem it seems is that I know so little about using VB that I don’t even know where to get started. I’m looking for a book or website that will hold my hand through writing simple programs. Hopefully something related to using VB to control MS Access.
I think that once I know how to do the basics, I’ll be able to do trial and error to figure out how to do what I want to do. I just need to figure out how to do simply things like create an Access file, run a query and write data to an access file, and someway to open up a form to edit data in a database.
Without knowing exactly what your applications are I have another suggestion.
Have you considered using the VBA MACRO programming already available in Excel and Access?
I’ve found it to be easier to use macros from within Excel to manipulate data in and out of the workbooks.
I’m currently learning Visual Basic Express and while I’m excited about having total control over my resulting applications I am somewhat disappointed that it isn’t as intuitive as VBA.
One of the nicest features of programming in VBA is that you can turn on a macro “recorder” and then go to the spreadsheet and perform a task like open a file, copy, delete or enter data. While you are doing those tasks the recorder writes the VBA code that mimics your tasks. You can then view the code and then modify it and add it to your program. I still use that feature whenever I forget how to write the code for say copy from one sheet to another.
If you are interested in VBA I suggest one of the “Power Programing with VBA” books (either 3003 or 2007, whichever MS Office version you use) by John Walkenbach.
I also liked the “Excel VBA programming for Dummies” book by the same author.
BubbaDog’s right. It will be easier to write Access stuff in VBA than in VB for most of what you’ve mentioned. VBA has the libraries and setup that you need to work in Access. I’ve tried importing the Access libraries and working from outside; IME, that can get wonky. OTOH, I’ve had pretty good luck at getting VBA to do stuff outside of Access (file operations, etc.).
In Access, there’s no VBA recorder. What you do is open a Macro (on the Macros tab) and set up what you want there. Those are pretty easy and self-explanatory and will do most of the things you mentioned.
Once your macro is saved, go to Tools/Macro/Convert to Visual Basic. It will save the macro into a VBA module and you can customize from there in the module.
I’d need more details about exactly what you’re doing to give you anything more specific.
I go to the microsoft.public. groups a lot for info, as well as the comp.databases.ms-access group, or just Google for the particular item I’m trying to figure out. There’s a lot of info out there, and I’ve found most user forums to be friendly and helpful. Googling for ‘Access VBA tutorial’ brings up lots of pages, if you want to start that way.
As for VBA, it’s probably sufficient for my task, however I’d like to learn VB for my own benefit as well. Unless there is an order of magnitude in difficulty between VBA and VB, I think VB is the way I’ll go.
Well treis we’re in the same boat. After working with VBA for so long I too am looking to learn more about about VB.
So far I haven’t found a reference source that’s as useful as the Walkenbach books were for VBA.
I bought one book because it was fairly cheap (under $20) called “Build a Program Now - Microsoft Visual Basic 2008 Express Edition” By Patrice Pelland.
While it has some great starter info and step-by-step instructions on specific program construction, it seems to be geared more towards the use of the Visual Studio program which you use to create and compile the VB programs. Useful for that reason but it doesn’t really get into the nitty gritty of VB.
I still want to have a reference book with some explanations of basic to intermediate terms and statement structures.
If I find one I’ll bump this thread with the results. Until then, I’m relying on google by typing in keywords like “Visual Basic” and “open CSV file” to help me get a better understanding.
I had a very bad experience with VB several versions ago and never recovered. And I hate Visual Studio. I’m gonna hafta learn .NET one of these days, though.