Been away for day..sorry I could not response sooner!
Oh well..this thread is a bit old now..but lets take a shot at this!
I use VB6 as an example because it's arguably the closest to MS
Access. Even so the forms engines are very different, and that's my
point in a nutshell. I could counter that the next 'VB6' is called
Whidbey and the next version of MS Access will be Access2000 with a
few more bolted-on tools and without the developer's version having
the redistributable runtime you will have lost more than you will have
gained, but that would be too off thread.
That is fair. However, remember we had ms-access for 10 years now. We got
dao, and when ado came along..we got that. When the VB6 language came out
we got that too. When Microsoft released sql server, then ms-access became
a client for that.
Now we are going to run under managed code in .net. It seems to me that the
path towards .net is, and will have been much less painful via ms-access,
then VB6. And, the main reason for this is that Excel and word are too
important to Microsoft...and ms-access is also part of office...so it gets
to go along for the ride. This ride is result of MS wanting to keep
Excel and word users happy! So, we had ten years..and the way
things are going now..we will get another 10 years. A rather impressive
run. Further, I don't think MS wants to repeat the forking that
occurred with VB developers when .net came along.
Incorrect. ADO, whether in MS Access or VB6, allows you to maintain
the recordset object's ActiveConnection property e.g. issuing the
Update method sends any changes to the data source, meaning a bound
recordset. And in VB6 you can associate a connected recordset with an
ActiveX control i.e. you can have bound controls too.
Actually, I need clarify what I meant by "don't *have* to" :
All I mean to has said is that in VB6 you don't have bound forms...but in
ms-access we can have a un-bound form. So WE have a choice..and
with VB6 you don't have the choice of a bound form, or un-bound.
And, to be sure a ado data control placed on a VB screen does
get you bound fields to that control. However, this is NOT the same as
having a bound form. (this difference is important, since the form
is a user UI object..where the ado data control is not (well, you
do get some navigation buttons..but the primary use of the data
control is NOT UI..where as a bound form in access is a UI
object...this distinction is important since it means that
the access form is geared towards UI).
So, a bound data form in ms-access is still a different animal
and conceptually much different then what a VB ado data control
is..
Anyway..so...I was saying that VB does
not give you a *choice* between a bound form..or not bound.
Why then is MS Access not the number one choice for SQL Server based
apps, I wonder?
Well...actually...it might be! In fact, when I look at the large number of
posts of people using ms-access with oracle here..I would easily bet that
ms-access is the most popular client to oracle NEXT to Oracles own product
line (we are talking about a non ms server product here!). In other
words...ms-access is a VERY popular client to database engines. Right now,
usually that engine is JET..but more and more it is sql server. Remember,
you have to
view ms-access as a rich data client with a VB programming language.
As a data client right now..ms-access is likely the most popular data client
in the marketplace by a large amount. Perhaps only Excel would be more
popular then ms-access in this regards.
However, ms-access *should* be used with sql server more.
One of the questions asked at the MVP summit was how to get the
message out about adp projects. (or, just the fact that you can use sql
server with ms-access). Ms-access still as general rule faces
hostility from IT debarments (the old stories about it not a robust tool..
and can't scale). Further, the IT department can't control ms-access
very well..so they don't want it. The same goes for Excel..but they
can NOT take away Excel from users! It is rather kind of sad that
so many companies ask for, and need some server client abilities with
a product..and only later realize that ms-access is a great client
and solution to many problems.
Most of the time access gets dumped on bad advice, or companies not
knowing about the ability of ms-access to work with the corporate
data server ...be it sql server or oracle. I seen this time and time again
as some consultant walks in and says that ms-access is not a secure system
or ms-access can't scale. This kind of advice is just plain
wrong, ....but one of the things that access developers encounter all the
time.
The other rumor of course was that ms-access is dead..and not
going to be supported by MS. We had that rumor for years. Of course...
with VB6 on its way out...for some strange reason we don't seem to
get that bad rumor anymore as companies upgrade to new versions
of ms-access....and more versions are on the way!
Anyway, companies that have invested 10+
years in software development using ms-access continue to get support,
and are continued to get new features year after year. A rather
impressive ride. I see another good 10 years with this product.
Also, there is also a good deal of hostility, and lack
of respect among experienced developers as to ms-access not being viewed
as a serous development tool. All the tools like the code librarian, VSS,
creating class objects etc are a part of the ms-access development
experience.
If ms-access had always been part of Visual Studio..and not part of office
..likely this lack of respect situation would not be so
bad. However, likely ms-access would not be by far and away the most
popular data client system either..so ms-access ties to office is both its
best feature..and it's worst feature at the same time..
For example, I remember that for some time dbase/FoxPro developers
will not viewed as being that serous developers. Now that FoxPro is part of
VS, then it gives it more credibility. Also, why use ms-access when it will
cut down billable hours?. I suspect that some of the hostility towards
ms-access is the "amateur" status, and that is so widely available.
Not everyone has VS on their pc..but with a large number sure
has ms-access. This tends to give the impression that the product takes no
skill to develop with. It also makes the tool *super* popular....
Incorrect. The Data Environment can be bound ASAIK and other controls
can be bound using either a ADODB Data Control or a connected
recordset object.
As mentioned...I don't consider dropping a data object on the screen and
binding controls to that a bound form. It certainly does give you bound
controls..but not bound forms. We could consider this issue just one of
semantics..but really..there is a big difference between the two.
I take up your challenge! I'll try to add a listbox to a form,
populate it manually with some items and show a message using the
selected values. Maybe the following description of my experience will
demonstrate what I've been trying to say (and/or make me look a fool
but never mind!)
I open a .mdb file in MS Access 2003. I need a form so I choose Insert
Form,
Up to the above....sounds good.
choose Design View from the unasked for wizard
Hum....not too bad...we got so far:
Insert->form->Design View->ok
At this point you get a blank form....seems good to me!
To be fair..in vb6 you are transported RIGHT into a wizard screen, and
whacking ok gets you a blank form "ready" for development. However, while
this is easy..it is also simplistic approach to starting an application....
Remember...we do inherit much of "mental model" from the office
suite....so you kind of have to think in terms of that mental model. Of
course, when using software...that "mental model" (MM) is very important. If
you are used to a desktop publishing program, and insert a picture into
that document and whack save..that picture gets saved. Now fire up a
graphical web design program and insert a picture..and
whack save...the picture does not get saved. The user will now be VERY
confused. You might say this is stupid that the program does not save the
picture when you hit save. To me..that is not bad..but just a different user
experience.
This is due to that different mental model. For both users..and developers
understanding, and being ready to change the MM is the key to learning new
concepts. So, you can read up on some of simple ideas on UI based on this MM
in this article of mine when you got a sec:
http://www.attcanada.net/~kallal.msn/Articles/UseAbility/UserFriendly.htm
close the form
expecting a save as dialog but the form has disappeared. Start again,
this time explicitly save the form by choosing Save As (I must specify
to save as a form?! Mind boggle at what else it could be!).
No, it is not mind boggling. However, you likely not used word much, or not
used Excel much? Perhaps you don't use office programs on a daily biases.
If you have used office programs...then the above concept or "MM" will
make perfect sense.
Launch excel. You will see that it opens to a blank document. Even if you go
file->new->blank workbook. Now, close excel? Notice how you get no
prompts..nothing is asked to be saved. that blank piece of whatever is
thrown away.....
The same goes for word..(try it). Launch word..go file->new...you get a
blank document..but if you close out word....no save prompts.
So, you ONLY get a save prompt if YOU MODIFY the form. If you close out that
form with no changes..then no save takes place. Most of office has worked
this way for the last 10 years (this goes back all the way to windows 3.1)
Again, this really the issue of the Mental Model we have. So,
I can't say this is a bad UI thing. So while you may
not like this different approach (mind boggle as you say), it is the fact
that all of office software tends to work this way. Office software is
arguably the most popular software in the world today and has worked
this way for a long time.
So, this "behaviors" you talk of should not surprise anyone who is going to
write software with users in mind. In fact, most users will EXPECT the above
behaviors in YOUR software you write. Thus, you should seek to emulate
this behaviors for your users also when writing software also.
I remember how difficult it was for some dos based FoxPro/dbase
developers to make the leap to "event driven" programming that ms-access
offered. It was a very large change in the users MM, and caused a lot of
grief for these developers. So, while you may find the change to ms-access
different...most software developers SHOULD as a matter of design concepts
adopt the MM way of how office works..since that is what most people use.
Form is
now closed and saved. Choose View, Code: MS Access goes GPF
Gee..that sucks ..don't it!!!
At least I can say that we now have Dr. Watson integrated into office..and I
hope you whacked "send report". MS will watch the frequently of reports
of your problem..and that data sent will help MS to make a fix. Stuff like
Dr. Watson integrated into improving products like ms-access is a revolution
into software quality...something that other competitors to ms need to
learn.
However..I also had a few GPF errors in a2003..and I hope it is something
with
my install. I will say that a2003 is rather new...but it is not
re-assuming. Most my dev is with a2002..and it is very solid for me.
I guess the first release of the .net tools was quite nasty also....but I
not
going to make any excuses here.....(that is yuk!).
Anyway..your above steps DO NOT gpf on my pc..(I am using a2003
here!).....my a2003 seems ok stability wise..
Ok..so at this point we got that blank form in design mode. (and, like word,
excel, and most software if you close it..you loose it..since you done
nothing).
Note also how we get a instant project..since any form,
report etc is PART of that ONE file wonder. In one slice of the knife, we
have a full project file..and don't have to worry about all the pieces..as
they are in a nice container. So, you do NOT have at this point be burdened
with choosing a file LOCATION. Since the whole thing is ONE
thing!.
See, we are already saving development time
here..and don't even need to create a folder to hold all this stuff!
So, that mdb file is a instant project. You can email it, you can
grab and copy the WHOLE application by simply copying the file, and that is
a
LOT easier then copying a whole bunch of files/folders in a dir. Further ,
you can
copy that file to another pc..and it just runs!. This one file wonder of a
mdb is perhaps another one of those great software revolutions that
ms-access
has.
And, look how easy it is to send the application somewhere else! People in
..net
are just now starting to talk about the wonders of x-copy development and
the
end of having to create a install routine. Here is my file..just run
it....great new world awaits us developers in this regards (but access folks
have had this for ten years now).
finally get the VB editor to open.
At this point...we normally don't go to the vb editor. We would simply drag
the listbox from the tools onto the form. In fact, you select the listbox,
and then click on the form (same as in vb)
Further..we do NOT have the same concept as a run button for our forms
(in VB, both code, and the forms are executed via the "play"/run button).
In ms-access, a form is not "run",but simply flipped into view mode.
Again, this process is much nicer in ms-access. However, it is different
but also better! Why? Because then I can navigate through 6 or 7 forms
deep..and then whack the design button.
Oh boy..I always missed this ability in vb...you navigate your way to a spot
in deep into the application...and then need to change code, or something on
the form.......(how do you get that spot in VB). In ms-access..you simply
whack
the design button, and what you are looking at is now in development mode.
Heck, this means you don't even have to remember or KNOW the name
of the form you are looking at when you want to change it!!! This unloads
a large amount of mental effort during development. My last application
that is considered SMALL for ms-access had a 160 forms, and yet the
resulting application can be zipped onto a single floppy disk. With
that many forms...I don't even how to worry, or remember the form
names to modify..I simply navigate via the application to where I want
to go..and then jump right into design mode. Just fab this is! And,
those 160 forms took less then 1/3 the time to develop. (actually,
it is likely a greater factor then that).
So, sight differ model..but one that lets you jump into design mode at
any point...all IDE's should work this way!
This response of mine is already getting too long here! Anyway,
I find the switch between design, and run mode far more fluid
and easy in ms-access then just about all other IDE's I used...
Phew! Choose List0 from the
objects, look at the events: seems to be the normal quota, wonder
where are all the extra events I've heard about? In the Form_Load
event, add some items e.g.
Actually, you should be looking at the form in design mode..and select
the listbox on the tool bar..and then just draw the listbox on the listbox
onto the form. And..you should likely use the wizard the first
few times (the wizard means the Accounting guy down the hall who has
never coded can do this also!).
With List0
.AddItem "One"
.AddItem "Day"
.AddItem "When"
End With
You actually don't need any code....after you drop the listbox on the
form...right click on the listbox control and select properties (and your
properties window appears). Now on the data tab....set the row
source type to value list.
On the next line in the properties sheet called Row Source..just type:
One, Two, Three
You are done. Notice how we have ZERO lines of code. In fact, if you do set
the listbox setting as value list..then in code you COULD go in the forms
on-load event:
me.List0.RowSource = "One, Two, Three"
So, the above is ONE line of code. That is still %500 less code then your
example code of 5 lines (so far). That is 5 times less so far!
Want to test the form, press the 'VCR Play' button, doesn't run the
form but brings up a blank list of macros.
Yes..as mentioned we don't run a form..but simply flip the form from design
mode into form view. And, as mentioned, if you are following my steps
above..we have not YET even seen the VB IDE if you use my above
code-less solution. And, if you do use the above code solution..you
are still at one line of code.
You have to remember, that our forms do NOT necessary
need to have ANY code at all to function! A form can
have zero code if you wish..and still do useful things like
edit data!
Once again you have a different MM here. So, you don't
run forms..but simply view them. (and..what could be
more natural?). I can assure you during
development.this saves tons of time..and is MUCH faster to flip into
design mode the it is into "run" mode that VB has.
OK, so add a standard
module, add a public sub named 'Test' to show the form from here. Try
Form1 but haven't got that object, notice in the VBE its called
Form_Form1 (why?!),
Well, because each form you make in ms-access that has code becomes a class
object of name "form_YouFormName". So, each form is a class object, and
any public code function becomes a method of that form. (this is also how
VB works..but you don't get a class object name as above...in VB the
form name becomes the class object). (there is several reasons why
this is done..but again ...my post is already too long...one reason
likely is that forms can be code-less).
OK that's a public object but it hasn't got a Show
method, look for something else (notice it has many properties named
as if they were events e.g. AfterUpdate, BeforeInsert, etc - weird!),
Ah...see..there is all that extra stuff I was talking about! All
forms have those extra methods..and properties....there is
lots of extra stuff here!
try to load it:
Load Form_Form1
The access IDE is VB6 (and I am told that the compiler and code system is
actually the SAME CODE base as VB6. So, you have load..but
load is for user forms..and NOT ms-access forms....so..do not use load
.......it is there..but not for us!).
To open a form..you use:
docmd.OpenForm "form1"
At first think it hasn't worked but the form is shown behind the VBE
window (!!). Success! But there is something that looks like the ADOBC
Data Control at the bottom of the form, that will have to go. Go to
the form designer again
yes..while looking at the form..right click..and select design view....
(much better then closing the form as you must in VB). Once you
get the hange of right-click->design..you will like this.
look at the form properties, can't see anything, look again and
realize I must change drop down to 'Form' (why?!)
Great question! In VB you can simply click anywhere on the form
and you have now selected the form. The problem is with ms-access
forms, you click on the form..you have selected the detail section of that
form.
That detail section has all the standard events (click, double click, on
mouse down etc. And that detail section also has all kinds of properties
you can set also (back color,, back imaging....etc.....quite a bit of
stuff).
You have all of this features in VB forms..but you don't have 5 sections!
If you go view-header/footer, you will see that you can click on the
header (it also has it own click event...along with all kinds of
propriety).
If you click on the footer section, then once again you get all the events
and properties. So...you got 5 sections to deal with.
(see, I told you those access forms are more complex).
So, all of the events and properties apply to each section of the form.
VB forms are one simple thing.....and thus very simple...
The ms-access form has header, footer, page header, page
footer. So, that is why you can't just click on the form and then use/set
the properties of the form..since our forms are so much more complex.
By the way, those form headers and footers can do some real cool things
for you. For example, you can use the footer of a form to generate totals
on a invoice form..and once NO CODE is needed to do this. Again,
you learn to use those sections correctly..you will eliminate TONS of code!
Imagine that...the form footer can generate totals of data for you with
out using code!
And, having sections also gives developers a very nice organizing of
the form. I mean, obviously things like text heading that explains
what the form does etc goes in the heading part. And, detail section
usually has the data controls in it. This is again why I see so much
better data applications written in access (in VB..there is no structure
to the form design). And, you are free to put data contorsl in the headder
or footer if you wish (but as mentioned some things will behavie differllty)
Anyway, it is rather incredible that those sections can be used to sum
totals
etc without the need for code. If you look at the last screen on the
following
page..you will see a typical invoice/detail form. Those totals (total paid
etc). on the bottom of the payment details took NO code to create!
By the way, you can see the use of lots of sections in that form
also. And, further...that form has about 5 sub-forms. This means that
the form is again managing relations between data (the database relations
between 5 tables are managed for me in this case also).
http://www.attcanada.net/~kallal.msn/Search/index.html
So, now that you realize why clicking on a form dos not select
the form..you do have some shortcuts to select the form:
You can quickly select the form by going ctrl-r, or
simply whack the square in the upper left hand corner of
the screen (that is usually what I use).
So, we have form sections..and as mentioned they once
again force a very nice consistent design through out the application
At this point I give up, concluding
that MS Access forms are a totally different experience, so doing even
a simple thing throws up all kinds of issues.
I can only say that I demonstrated how to fill that list box with zero lines
of code..or one line of code if we choose to do so. And, I explained
the fact that our forms have several sections to them, and again this
feature results in incredible gains in productivity. The VB forms
are not even close.....
And, I should point out that those native controls to ms-access are in
fact NOT activeX controls. So, you do have to learn a different approach
here. (by the way..you can insert activeX controls..but then you now
need a install routine to deploy the application...(that means the
developer edition of ms-access is needed if you start using real
activeX controls).
And, really..try making a listbox with the wizard..and see the results you
get. Of course...using the wizard to make your listbox means that
anyone who can use a mouse can build that listbox..and
not even know how to code....
Also...my apologies for the length of this post.....if my writing skills
where half as good as my coding skills...I would take the some to
shorten this post by 1/2... (sorry for the length...).