• Examples using Access database

    Home » Forums » Developers, developers, developers » DevOps Lounge » Examples using Access database

    Author
    Topic
    #474093

    I’m just dipping my toe into Microsoft Visual Basic 2010 Express after a number of years with Access 2003 – no expert, but I get by.

    I was looking for some bigger samples of code – something like the NorthWind example which comes with Access – that show how to design / program Visual Basic applications to link to an Access database. NorthWind was useful in that it showed lots of different techniques with the code behind it. I don’t suppose anyone has re-written it using Visual Basic?

    John

    Viewing 2 reply threads
    Author
    Replies
    • #1263192

      John,

      See if this tutorial is of any help. I believe it uses the Northwind database;

      http://www.techotopia.com/index.php/Accessing_Databases_Using_Visual_Basic

    • #1263630

      Hi John

      I’m doing pretty much exactly the same thing, but I use SQL Server express as the database because I’m a cheapskate and don’t want to pay Bill for a copy of Access on my new PC. Experience to date is that once you’ve set up the data connection the VB stuff is probably identical whatever database you use. I found a big collection of Microsoft video tutorials on linking VB forms to data:

      http://msdn.microsoft.com/en-gb/vbasic/ff718212

      I’d like to get to know Beth Massi, she is very calm and clear and I’m sure with her at my side I’d never get stuck!

      Those turorials were an enormous help in the early stages, and I still refer to them when I forget how something works. Although they relate to VS2005, things have hardly changed in 2010. For other things, bookmark various sites in MSDN. There’s lots of sample code, mostly using Adventureworks but some using Northwind. I particularly use the documentation for the system.windows.forms namespace in .Net Framework 4:

      http://msdn.microsoft.com/en-us/library/k50ex0x9.aspx

      and then Visual Basic developer reference:

      http://msdn.microsoft.com/library/2x7h1hfk

      What I can definitely tell you is that VS2010 is a shock to the system after Access 2003 VBA. On the good side there’s a huge amount of drag and drop functionality in the IDE which saves a ton of code. The Intellisense on VB is far better than VBA and during debugging VS will sometimes even fix the code for you. On the downside, many things that were a complete piece of cake in Access are a pain in the bum in VB. For example, turning a textbox into a combobox, one click in Access, takes about 5 minutes in VB!

      If you used good naming practices in Access you’ll find VB rewards you. If not, prepare for some problems. Although I like to see myself as a professional coder I slip into rubbish naming sometimes, so when my project used a table called “Events” VB went bananas. It tried to create a property “mytableadapter.Events” and BOOM! There’s already a built in Events property which enumerates handles events. Renaming the table to tblEvents took days, in fact I ended up deleting a number of forms and recreating them rather than dig through all the table adapters, datasets, binding sources etc.

      Good luck

      Ian

    • #1263641

      Thanks both for your help, encouragement – and warnings. I guess there is never an ideal – Access 2003 is great for some things, VB will, I’m sure be good in other ways. Progress is never in a straight line (certainly not forwards). It will take a while to switch, and I’ve no doubt I’ll stay with Access 2003 for much of what I do, but it would be useful to use VB for some, especially when I need to produce a compiled version of an application

      Regards

      John

    Viewing 2 reply threads
    Reply To: Examples using Access database

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: