Please help with Visual Basic Programming

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is probably going to sound silly, but I would like to find out how to
run VB in Access. I see all kinds of code and programs running around the
newsgroups that seems to accomplish some of the things I want to do, but I
am not sure how to use the code. For example, there is some code to
automatically email reports. Great, but what do I do with it?

If someone would be so kind as to point me to a tutorial or give me step by
step instructions on how to run a VB program from access that would be
great. BTW...I have a few books that give all kinds of coding examples, but
no information on how to implement the code. I hope this makes sense.
 
This is probably going to sound silly, but I would like to find out how to
run VB in Access.

It's actually VBA - "Visual Basic for Applications" - a language
dialect of VB designed to work with the Access object model. If you're
familiar with VB you'll note some differences (and trip over some
others unwittingly).

Most code is run from an Event on a form or report - if you just want
to run code at a user's request, the commonest way to do so is to use
the Click event of a form button, but forms and reports have many
usable events. To actually get into the code editor for an event, open
the Form in design mode; select the control (or the form itself, or
whatever), view its Properties, and on the Events tab select the
desired event. Click the ... icon and invoke the Code Builder or
simply doubleclick in the event line; the line will display [Event
procedure] and you'll be thrown into the VBA editor.
 
John said:
This is probably going to sound silly, but I would like to find out how to
run VB in Access.

It's actually VBA - "Visual Basic for Applications" - a language
dialect of VB designed to work with the Access object model. If you're
familiar with VB you'll note some differences (and trip over some
others unwittingly).

Most code is run from an Event on a form or report - if you just want
to run code at a user's request, the commonest way to do so is to use
the Click event of a form button, but forms and reports have many
usable events. To actually get into the code editor for an event, open
the Form in design mode; select the control (or the form itself, or
whatever), view its Properties, and on the Events tab select the
desired event. Click the ... icon and invoke the Code Builder or
simply doubleclick in the event line; the line will display [Event
procedure] and you'll be thrown into the VBA editor.

YEEEEHAAAAA!!! You are the King!!! That simple little instruction gave me
a huge leap forward. Thanks.
 
That simple little instruction gave me
a huge leap forward. Thanks.

You're welcome! Sometimes it's just the little things that cause the
biggest headaches!
 
John Vinson said:
You're welcome! Sometimes it's just the little things that cause the
biggest headaches!

:)

But seriously, I do all my automation in VBA events, but a professional
application writer I know does all his automation in macros and _never_ uses
events. In fact he positively thinks they were the worst things ever
invented.

I have never used an Access macro. What are the benefits of macros vs
events??

- Peter
 
Peter Smith said:
:)

But seriously, I do all my automation in VBA events, but a professional
application writer I know does all his automation in macros and _never_ uses
events. In fact he positively thinks they were the worst things ever
invented.

I have never used an Access macro. What are the benefits of macros vs
events??

Pardon my bluntness, but I wouldn't call him a very good "professional
application writer" if all he uses is macros, and he never uses events.

To write a "professional" application, you really need to use VBA, not
macros. Macros don't allow for any error checking, and it's a poor
application, in my opinion, that can't gracefully handle errors.

And events are the whole point of Windows programming. Without responding to
events, you can't have user input in your code.
 
Back
Top