bound forms vs. unbound forms

B

BillE

There were angry words on this group a couple of days ago on this topic.
I'm wondering what the consensus of other Access developers is regarding
bound forms and unbound forms.

I often use unbound forms and I create classes, like a Customer class with
properties used to AddCustomer, UpdateCustomer, etc. I will also have a
data access class which perfoms all data related tasks. I also do a lot of
VB.Net development and I feel more comfortable using a sort-of object
oriented approach. I also find that complex forms with subforms are easier
to manage when unbound. It seems easier to locate problems, by stepping
through the code. Maybe if I spent some time learning to use bound forms
better, there wouldn't be problems to solve.

I don't necessarily advocate unbound forms, that is just how I often do it.
Most projects are a mixture of more complicated unbound forms and simpler
bound forms, like popups for adding comments.

I like Access because of the reporting, easy GUI design and implementation,
the database schema tools, the query tools, etc. But not so much for bound
forms.

To be honest, I don't like to use complicated bound forms because I always
seem to end up trying to figure out the reason for some referential
integrity violation or something and I find it is easier to just write code
where I know exactly what is happening.

This certainly must be because I have not mastered the techniques of
developing in Access with bound forms and have taken the lazy way, since
advanced developers seem to prefer bound forms.

However, it doesn't take me that long to write code to do what a bound form
would do even if it worked the way I want it to.

Hopefully nobody is offended by this - I'm just curious about other views.

Bill
 
B

boblarson

I, for one, don't like writing code where I don't have to, so I tend to use
bound forms and letting Access handle the details of a lot of it. So, I like
bound forms myself. But, I've used unbound too, on occasion, when I needed
to do something that a bound form either didn't do, or would have taken more
to do than just using an unbound form.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 
A

Albert D. Kallal

For sure this issue of bound forms VS unbound forms can always conjure up
quite a heated discussion.

The major problem here is that most developers coming from other
environments are used to an unbound type of design model.

Furthermore when you need richer or more complicated interfaces in MS
access, you really only have two choices:

apporach #1) Reduce the complex user interface and design your application
with the MS access interface in mind.

I can't stress how critical the concept this is that you *make* your desings
fit access. For example, we don't have the ability to put a continuous form
inside of a continuous form. However often we need this type of many to many
UI. A great example of this is the classical distribution of funds from a
given check amount. That is you enter a check value of amount into one
column, and then must distribute the total check amount into other expense
accounts. I can't say every person who's done a lot of business software has
encountered this type of interface, but pretty much every one had to do this
type of code once in their life.

We really don't have a drill down control in MS access to accomplish this.
So the solution was rather simple, but the simplicity is a result of
sticking to what WORKS in the MS access interface.

The interface design I used as a screen shot is posted here:

http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

(just quickly scroll down to the very last screen shot, you'll see the list
of people and check amounts on the left side of the screen. On the right
side I'm able to distribute the funds of the check out to "many" separate
accounts, but they both must balance.

So the solution I came up with was to simply placed two sub forms into a
main form, and the result works really wonderful. Again I can't stress that
the lesson we learned here is that you must design for the MS access
interface, not the other way around.

approach # 2) consider unbound forms to get the contorl or interface we
need, or better yet simply dump the use of MS access.


The main problem with using unbound forms in MS access is that you give up
the complex forms object model. Of course the access forms object model is a
labyrinth of events. It most certainly can be confusing and catch you with
your pants down often (That's your comments about making this confusing
often makes sense). However, it is this complex object model that also gives
us the wonderful power and speed of development that MS access has.

The instant you break outside of this bound design model, you give up all
the tools and wizards and everything that is built in to give you high
productivity that access is famous for.


A great example is all the extra events we have when you use bound forms,
for example just think of what occurs when you load up a form:

compared to VB, we have TWO significant and two distinct events that occur
when a form loads (Compared to vb's 1 event).

we have:

1) on-open event
The on open event is a really cool event because allows you to have code
test for conditions that will actually prevent the form from a actually
loading (and becoming visible). Furthermore this event is too soon to
actually modify data on form's controls (but you can inspect values in
contorls). The beauty of this event is thus that you can actually build
things like record locking code, and if you fail to get a record lock on
your data, then you can prvent the form from loading.

It is only after all of your so-called test code, or criteria code passes
that the form can then continue to the on-load.

2) on-load event
The on load event is were all of your forms setup code, variable
initialization code etc goes (in fact it's just wonderful to have two events
to force developers to distinguish and palce different kinds of start up
code in two different places for that form -- as the develop or I know
exactly where to look for the initialization setup code, and I also know
where exactly to look for for code that will canceled and prevent the form
from loading -- in vb land this distinction is never made nor is it
formalized in such a nice way). furthermore what's really nice is if you're
all on open event cancels, then your setup and in its place nation code in
on load will never run.

My point here is that if you start using unbound forms then you essentically
give up the wonderful two separate features and events. For a unbound form
to use the on open event to cancel a form load, then you'll have to put in
all of your setup code, and all of your data binding code into that on open
event, and that's gonna get a bit messy (and if you move all the code to be
on load event, then you'll actually see the form appear). I sure wish the vb
environment had a really nice event that you could cancel the form load (and
have a wonderful place holder for the cancel code *in* the form like access
does). In the VB environment you're calling code gonna have to set this up,
and it's messy to cancel a form load without the form being viewed at all.

Furthermore bound forms have a ton of events such as before update, after
update, before del confirm, after dell confirm.....the list goes on and
on...its huge.

We can have a user selects several records on a form or continuous form, and
then hit the delete key, and the appropriate delete code will repeatedly run
for you automatically. To duplicate this type of behavior is in un bound
form is going to take a lot of code writing.

Furthermore there's just tons of little things like for example

if me.newrecord then

hey, this is a new record, let's do something different ...

or

if me.dirty = true then

hey, the user has modified some data on some control, let's do something
else

So we have the use of all kinds of little flags and form settings to tell us
if this is a new reocrd, or the form is dirty. And, we don't just have one
event like the reocrd being updated, but we have before update, an after
update, on insert new record, and the list goes on and on again.

Each one of these events when used in the correct specific manner, yields
incredible productivity from a developer's point of view. The trick as I
stressed is you must design your applications around the correct use of
these events.

The instant you use unbound forms, you give up all of these events, and you
give up all of the settings like dirty, new record, etc and they cannot be
used.

In these other environments they have a very rich host of tools built around
an unbound forms object model. Therefore these other environments provide
truckloads of special data connectors, data binding options, and all kinds
of things that are built around forms that are not data bound. In fact you
have years of tools desinged around a unbound object model.

The problem is when you move an unbound design approach to MS access, you're
getting the worst of both worlds, because you can't use the massive amount
of built in data features that a form has, and you also have no support and
no bunch of wizards built to help you do all that data connecting that these
other un bound platforms have.

In effect you'll be writing code at a slower pace than those other
development platforms because they have all the super duper wizard and data
connection stuff build around their model. We have no such rich feature set
and tools to do that data binding in MS access, and therefore you give up
all the wizards and support.

There's certainly times when you want to use unbound forms for a lot of user
interface prompt type stuff. However if you've reached the point where you
find that the interface requirements you have need un-bound forms a lot,
then you starting to fit a square peg in a round hole.

You'll likely be more productive in an environment that's designed for
unbound forms, and gives you the kind of "fine" control and interface that
you need in your applications.

Unfortunately access is not really designed around that unbound concept, and
you certainly do have to give up a lot of features and things when you go
the bound road. as always on these issues and matters your mileage may
certainly vary, but I just think the price is too high to pay for un bound
forms, and perhaps for your situation you don't consider the price versus
the benefits too high of a cost.
 
T

Tony Toews [MVP]

BillE said:
I'm wondering what the consensus of other Access developers is regarding
bound forms and unbound forms.

I quite like using bound forms and for the most part use them. Other
than a switchboard form I use unbound forms maybe 1% of the time.
To be honest, I don't like to use complicated bound forms because I always
seem to end up trying to figure out the reason for some referential
integrity violation or something and I find it is easier to just write code
where I know exactly what is happening.

I suspect the biggest problem there might be in figuring out how to
properly use subforms. It does take a bit of work at the beginning
to really understand what is going on their.
This certainly must be because I have not mastered the techniques of
developing in Access with bound forms and have taken the lazy way, since
advanced developers seem to prefer bound forms.

I wouldn't say lazy so much as you are going with a route that you are
familiar with. I suspect your approach is a lot more work.
Hopefully nobody is offended by this - I'm just curious about other views.

Not offended at all. A good discussion is always useful.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
T

Tony Toews [MVP]

BillE said:
There were angry words on this group a couple of days ago on this topic.

What was the subject of the posting? I must've missed that
discussion. I like a good scrap. <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
A

Albert D. Kallal

Steve Schapel said:
Hi Albert,


Subdatasheet?

Hum....I can only say there is always some really smart and bright and
intelligent guy who sits in the back of the class and is part of the quiet
peanut gallery. He's always near genius, and always waits to throw a little
wrench into the discussion that makes a really great point......

I consider you one of you of those great brains sitting quietly behind the
scenes in the peanut gallery ......just waiting to point out a great idea
when the time not 100% perfect to do so!!!

;-)

True, quite true.......a sub datasheet is a very possbile UI
solution.........
 
B

Beetle

T

Tony Toews [MVP]

Albert D. Kallal said:
Hum....I can only say there is always some really smart and bright and
intelligent guy who sits in the back of the class and is part of the quiet
peanut gallery. He's always near genius, and always waits to throw a little
wrench into the discussion that makes a really great point......

I consider you one of you of those great brains sitting quietly behind the
scenes in the peanut gallery ......just waiting to point out a great idea
when the time not 100% perfect to do so!!!

;-)
Hehehehehehehehehehehe

True, quite true.......a sub datasheet is a very possbile UI
solution.........

With the accompanying performance hit of enabling subdatasheets.

Tony (still chuckling)
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
S

Steve Schapel

Tony said:
Hehehehehehehehehehehe

Agreed. :)
With the accompanying performance hit of enabling subdatasheets.

Not that I am aware of, Tony. I think you are talking about the
Subdatasheet Name property of tables. I was referring to using a
subform as a subdatasheet on a datasheet view form, which is an entirely
different question. No?
 
L

Larry Linson

BillE said:
There were angry words on this group a couple of days ago on this topic.
I'm wondering what the consensus of other Access developers is regarding
bound forms and unbound forms.
I often use unbound forms and I create classes, like a Customer class with
properties used to AddCustomer, UpdateCustomer, etc. I will also have a
data access class which perfoms all data related tasks.

Access already includes classes for adding, updating, deleting, and
accessing data. They are what makes bound forms "bound". Since you feel
compelled to write your own, why are you bothering to use Access at all?

I use Access because I've never found* any simpler, easier development tool
for creating normal individual, multiuser, and client-server normal business
applications. Should I find a compelling need (and that would be rare,
indeed) to go beyond the capabilities of Access, I can employ a vast array
of Windows API calls.

* but, hey, I've only been in the computer business since 1958,
so I might have missed a few stellar development tools.
I also do a lot of VB.Net development and I feel more
comfortable using a sort-of object oriented approach.

DotNet appears to be one of several appropriate environments for humungous,
enterprise-level, web-based, distributed systems. That's not the target of
Access. Frankly, IMNSHO, a lot of people waste a lot of time, effort, and
money applying enterprise-level, web-based distributed system development
tools to individual, multiuser, and client-server "normal business database"
environments.
I also find that complex forms with subforms are easier
to manage when unbound.

I thought so, too, back when I was just learning Access... because I came
from a code-intensive background, as seems to be your case, as well.
Fortunately, I devoted the necessary time and energy to learning visual
development tools, and saved myself a lot of time, energy, and stress, and
saved my clients a lot of development cost. My clients want their business
problems solved -- they don't feel a bit better spending several times as
much to solve relatively simple database problems with general-purpose tools
targeting a completely different application environment.
It seems easier to locate problems, by stepping
through the code. Maybe if I spent some time
learning to use bound forms better, there wouldn't
be problems to solve.

I did, and am solving different kinds of problems -- business problems for
my clients, not programming problems because of the tools I'm using.
To be honest, I don't like to use complicated bound
forms because I always seem to end up trying to
figure out the reason for some referential integrity
violation or something and I find it is easier to just
write code where I know exactly what is happening.

Engine-level enforcement of referential integrity is the best protection
available for preventing database developers and programmers from shooting
themselves in the figurative foot.
This certainly must be because I have not mastered
the techniques of developing in Access with bound
forms and have taken the lazy way, since advanced
developers seem to prefer bound forms.

No, the "lazy way" is to master the tools that will do your work for you...
its a far smaller investment than re-implementing things that are already
implemented for you, and doing it over and over again.
However, it doesn't take me that long to write code
to do what a bound form would do even if it worked
the way I want it to.

Then you must be a very efficient speed-demon at coding, because there's
years of effort by teams of very sharp developers behind the bound-form
functionality of Access.

Larry Linson
Microsoft Access MVP
 
A

Allen Browne

You asked for several opinons, and got them, so that's good.

Access is really good for developing data-centric software quickly.
Examples:

a) Controls bound to fields accept only appropriate data.
Feb 28 won't be accepted into a Date/Time field.
No code is needed.

b) In a bound from, the engine enforces validation for you, e.g.:
- Required and Allow Zero Length properties of fields
- Validation Rule for fields and the table itself
- Foreign keys with relational integrity
- Unique Indexes

c) Bound forms expose really useful events. The BeforeUpdate event procedure
of the *form* is ideal for cases where you don't want an engine-enforced
rule, but you do want to give the user a warning and allow them to override
it.

d) Subforms provide a suburb way to display multiple related records for the
record in the main form. Again, no code needed.

e) Access bound forms handle record locking - your choice of at least 3
different locking strategies.

You discard all that (and much more) when you move to unbound forms. It's
kinda like buying a moped and never letting the engine do it's work: you can
get there by pedalling, but it's going to much unnecessary work.
 
M

msnews.microsoft.com

Albert D. Kallal said:
Hum....I can only say there is always some really smart and bright and
intelligent guy who sits in the back of the class and is part of the quiet
peanut gallery. He's always near genius, and always waits to throw a
little wrench into the discussion that makes a really great point......

I consider you one of you of those great brains sitting quietly behind the
scenes in the peanut gallery ......just waiting to point out a great idea
when the time not 100% perfect to do so!!!

;-)

True, quite true.......a sub datasheet is a very possbile UI
solution.........
 
D

David W. Fenton

To be honest, I don't like to use complicated bound forms because
I always seem to end up trying to figure out the reason for some
referential integrity violation or something and I find it is
easier to just write code where I know exactly what is happening.

In my 11+ years of professional Access development, I've never once
had to write code to handle referential integrity issues. Instead, I
use bound forms to manage it all for me, and appropriately chosen
controltypes for restricting entered data to valid values.

Seems to me you need to go back to Access 101.
 
D

David W. Fenton

However, it doesn't take me that long to write code to do what a
bound form would do even if it worked the way I want it to.

How do you replicate the .Dirty property, or the .OnDirty event? Or
the form's .AfterUpdate event? In the few unbound forms I've created
(in the small handful of cases where there were necessary), I've
written reams and reams of messy, dirty code to replicate what bound
forms provide without an additional line of new code.
 
D

David W. Fenton

For example, we don't have the ability to put a continuous form
inside of a continuous form.

This is not entirely true. You can use a *datasheet* with a
subdatasheet in it, or a main form with an embedded continuous form,
and view the main form in datasheet mode (in which case the embedded
continuous form with be displayed in place of the subdatasheet).

It's not the purtiest UI, but it works pretty well for two levels
(never tried it beyond that -- actually only discovered it
accidentally!).
 
D

David W. Fenton

Hum....I can only say there is always some really smart and bright
and intelligent guy who sits in the back of the class and is part
of the quiet peanut gallery. He's always near genius, and always
waits to throw a little wrench into the discussion that makes a
really great point......

I consider you one of you of those great brains sitting quietly
behind the scenes in the peanut gallery ......just waiting to
point out a great idea when the time not 100% perfect to do so!!!

;-)

True, quite true.......a sub datasheet is a very possbile UI
solution.........

Better, yet, a datasheet with a continuous form embedded in it...

(I've suggested this sort of thing before this thread, Albert, so
it's not just the quiet ones who know this trick)
 
D

David W. Fenton

Not that I am aware of, Tony. I think you are talking about the
Subdatasheet Name property of tables. I was referring to using a
subform as a subdatasheet on a datasheet view form, which is an
entirely different question. No?

Glad you posted it. I was going to liken his criticism to
badmouthing using lookup fields in queries, as compared to tables.

I just did some testing and it seems to me that the performance
issues of SubDatasheet="[Auto]" (which means the property hasn't yet
been created) are absent in A2K3. My guess is they just took out the
logic that figures out the existing relationships, which was, I
think, where the drag on performance kicked in.

It also seems that you can't use them at all with linked tables any
more. Not such a huge issue, as it is a UI consideration and ought
to not be in the tables at all, and is so easily implemented with
forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top