473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Unbound form questions

TD
I'm looking for input into my decision to switch to ADO and unbound
forms. I get tired of having to block all of the ways a user can
unknowingly save a record, like using the PageUp, PageDown keys and the
scroll wheel on the mouse. Also, I think that as the database grows in
size that it will eventually be moved to SQL Server 2005 Express.

With all of that said I started using ADO to manually work with my
unbound forms. It is a lot of work to get it to work. My questions
are these:

1. Have I missed something about controlling the saving of bound forms?

2. Any problems using ADO to connect with the backend database which is
for now Access?

3. If I use unbound forms how should I handle record locking?

I know I have more questions on this subject but this is enough for
now!

Thanks,
TD

May 10 '06 #1
11 3656
"TD" <dl**@adsi-sc.com> wrote

No matter whether you use ADO or DAO, you are reimplementing function that
is included in Access for bound forms. And, not only has it already been
implemented, it has been tested by tens of thousands of users for years and
years.
1. Have I missed something about controlling
the saving of bound forms?
Controlling the saving of bound forms is accomplished with code in the
Form's BeforeUpdate event. It is relatively simple to give the user a choice
to either Save or Return to the Form. You can include an Ignore button on
the Form that Undoes any changes, too, if you wish.

It is better to realize the (relatively few) circumstances that cause Access
to save, and code so that "inadvertent saves" are not a problem. Over the
years, I have only rarely had any need to take particular action because of
Access' automatic saving, but I have saved uncounted hours by learning how
to use, and using bound forms.
2. Any problems using ADO to connect with the
backend database which is for now Access?
As you may know, I am not a "fan" of ADO, but I don't know of any particular
_problems_ connecting with a split/back end Jet database. In the next
version, that will actually be an "Access" database, but, in the current and
previous versions, it is a Jet database engine database. I don't like the
idea of investing time and energy in a technology that has already been
superceded in the Microsoft development area that "really counts", DotNet,
by ADO.NET which is built on a different object model. Others, however,
think it is the neatest thing since the invention of sex, or at least since
the invention of pre-sliced bread.
3. If I use unbound forms how should I handle record locking?
Perhaps it would be facetious to say "in your code"? In general, you look
at the requirements of your application, and determine what is
appropriate -- and, in general, that would be "however you'd handle it with
bound forms". You do have additional flexibility, in that you can use
Transactions.
I know I have more questions on this subject but this is enough for
now!


From my initial answer, as well as the specific one, I think it is likely
that you are heading in the wrong direction unless you have some very, very
unusual application requirements.

Larry Linson
Microsoft Access MVP
May 10 '06 #2
"TD" <dl**@adsi-sc.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
I'm looking for input into my decision to switch to ADO and unbound
forms. I get tired of having to block all of the ways a user can
unknowingly save a record, [snip]


Your problem is one of perception. You believe that users "unknowingly saving a
record" is an actual problem that needs to be solved. The millions of Access
apps out there that don't concern themselves at all with this expose this belief
as incorrect.

If you want to eliminate accidental edits then lock the form and provide a
button to unlock it. This way the user has to clearly indicate intent when they
change a record. Then simply inform the users that changes are automatically
saved and move on to *real* problems.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

May 10 '06 #3
Per TD:
2. Any problems using ADO to connect with the backend database which is
for now Access?


"Problem" may be too strong a word, but if the data is in a .MDB, I would stick
with DAO because everything I've heard so far suggests that DAO is the best tool
for going after .MDBs.

Rightly or wrongly, I do unbound forms for almost everything. I find them
reasonably quick and easy to code now that I've done a few and I like having
complete control over what happens in "Browse", "Add", and "Edit" modes. No
tricks, nothing hidden - it's all up front in the VBA code.

Every so often, I drift back - but it always seems like that's the time the
users want to do something like validate a screen's contents in light of other
records before allowing changes tb saved.
--
PeteCresswell
May 10 '06 #4
"TD" <dl**@adsi-sc.com> wrote in
news:11**********************@u72g2000cwu.googlegr oups.com:
I'm looking for input into my decision to switch to ADO and
unbound forms. I get tired of having to block all of the ways a
user can unknowingly save a record, like using the PageUp,
PageDown keys and the scroll wheel on the mouse. . . .
Er, why not just control those, instead of adding all the work of
unbinding a form?

And if you're going unbound and your data is stored in a Jet back
end (i.e., MDB), then why in the hell would you choose ADO instead
of DAO? That would make no sense whatsoever.
. . . Also, I think that as the database grows in
size that it will eventually be moved to SQL Server 2005 Express.
That would be a reason to use ADO, but still no reason to use an
unbound form.
With all of that said I started using ADO to manually work with my
unbound forms. It is a lot of work to get it to work. My
questions are these:

1. Have I missed something about controlling the saving of bound
forms?
If you have problems with particular user actions saving a record,
then trap for those actions and prevent them from happening.

If other things still lead to a save, then use the record-based
events to check for those and cancel them if appropriate.
2. Any problems using ADO to connect with the backend database
which is for now Access?
ADO is a nonsensical choice for a Jet back end, but I think going
unbound is equally senseless.
3. If I use unbound forms how should I handle record locking?
You have to write a whole buttload of code and hit the back end
extra times.
I know I have more questions on this subject but this is enough
for now!


Don't go unbound. Just fix the original problems instead of going
with a Draconian solution that will cause more problems than it
could ever possibly solve.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #5
"(PeteCresswell)" <x@y.Invalid> wrote in
news:ek********************************@4ax.com:
Rightly or wrongly, I do unbound forms for almost everything. I
find them reasonably quick and easy to code now that I've done a
few and I like having complete control over what happens in
"Browse", "Add", and "Edit" modes. No tricks, nothing hidden -
it's all up front in the VBA code.


How can you do without the events, and the .Dirty property?

I just find myself re-implementing way too many things that I just
don't see any value in it just to get control over adding and
editing and saving.

Of course, on principle, I no longer use the same form for adding
records and editing them, except for relatively trivial forms. That
took care of 90% of the problems I had (which were mostly involved
with abandoning newly created records).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #6
Per David W. Fenton:
How can you do without the events, and the .Dirty property?


I use events extensively.

Maybe I'm just not using it properly, but I find that .Dirty gets too
complicated with, say, a half-dozen subforms.

Instead, I code a .MakeDirty function in the parent form and call it from the
child forms whenever something changes.

e.g.
---------------------------------------------
Private Sub cboWhatever_AfterUpdate
afterUpdateAllFields
End Sub

Private Sub afterUpdateAllFields
With me
.Parent.MakeDirty .Name
End With
End Sub

Public Sub MakeDirty(ByVal theFormName As String)
Select Case theFormName
frmOne
mDirty_FormOne = True
frmTwo
mDirty_FormTwo = true
frmThree
mDirty_FormThree = true
end select

with me
.cmdClose.Caption = "Cancel"
.cmdSave.Enabled = true
end with
End Sub
---------------------------------------------
That way I even have the option of keeping track of which children have been
changed. Also .MakeDirty can manage the .Enabled status/captions of the "Save"
and "Cancel/Close" buttons.
--
PeteCresswell
May 10 '06 #7
"(PeteCresswell)" <x@y.Invalid> wrote in
news:f6********************************@4ax.com:
Per David W. Fenton:
How can you do without the events, and the .Dirty property?
I use events extensively.


Not the built-in record events, since they don't fire in an unbound
form (e.g., OnCurrent, BeforeUpdate, BeforeInsert, etc.). You have
to recreate them in some form if you need them, and that is a real
pain, since there is often no single place to call them from, as
your example of replacing the Dirty property shows perfectly.
Maybe I'm just not using it properly, but I find that .Dirty gets
too complicated with, say, a half-dozen subforms.

Instead, I code a .MakeDirty function in the parent form and call
it from the child forms whenever something changes.

e.g.
---------------------------------------------
Private Sub cboWhatever_AfterUpdate
afterUpdateAllFields
End Sub

Private Sub afterUpdateAllFields
With me
.Parent.MakeDirty .Name
End With
End Sub

Public Sub MakeDirty(ByVal theFormName As String)
Select Case theFormName
frmOne
mDirty_FormOne = True
frmTwo
mDirty_FormTwo = true
frmThree
mDirty_FormThree = true
end select

with me
.cmdClose.Caption = "Cancel"
.cmdSave.Enabled = true
end with
End Sub
---------------------------------------------
That way I even have the option of keeping track of which children
have been changed. Also .MakeDirty can manage the .Enabled
status/captions of the "Save" and "Cancel/Close" buttons.


Why couldn't the built-in OnDirty event do the same thing? The
OnDirty event for the parent form wouldn't affect the Dirty
properties of the child forms (or vice versa, except for a new
record).

I've done all of this myself, and see no advantage whatsoever to
recoding all of this when it's all available in a bound form without
any coding. Of course, I also have never even contemplated an
unbound form with unbound subforms. That just strikes me as complete
insanity, sorry.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #8
Per David W. Fenton:
Not the built-in record events, since they don't fire in an unbound
form (e.g., OnCurrent, BeforeUpdate, BeforeInsert, etc.). You have
to recreate them in some form if you need them, and that is a real
pain, since there is often no single place to call them from, as
your example of replacing the Dirty property shows perfectly.


I guess I'm into semantics then. My "unbound" forms are actually bound - only
to work tables in C:\Temp.
--
PeteCresswell
May 10 '06 #9
"(PeteCresswell)" <x@y.Invalid> wrote in
news:u1********************************@4ax.com:
Per David W. Fenton:
Not the built-in record events, since they don't fire in an
unbound form (e.g., OnCurrent, BeforeUpdate, BeforeInsert, etc.).
You have to recreate them in some form if you need them, and that
is a real pain, since there is often no single place to call them
from, as your example of replacing the Dirty property shows
perfectly.


I guess I'm into semantics then. My "unbound" forms are actually
bound - only to work tables in C:\Temp.


Well, that's not unbound by any definition that makes any sense to
me.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #10
Per David W. Fenton:
Well, that's not unbound by any definition that makes any sense to
me.


Technically, I'd have to agree.... Functionally, however, the essence of
unbound forms to me has always been that the user is not "in" the back end while
working with the data.

But you're right, I've got to overhaul my use of the term "unbound".
--
PeteCresswell
May 10 '06 #11
"(PeteCresswell)" <x@y.Invalid> wrote in
news:84********************************@4ax.com:
Per David W. Fenton:
Well, that's not unbound by any definition that makes any sense to
me.
Technically, I'd have to agree.... Functionally, however, the
essence of unbound forms to me has always been that the user is
not "in" the back end while working with the data.


To me, unbound means that the form and its controls are not bound to
the fields in a table. That the table is not part of the live data
set is simply irrelevant to the idea of being bound or not.

The two sets of problems that exist with real unbound forms and with
using temp tables for editing are completely different and I see no
utility in porting the concept of "unbound forms" over to the temp
table scenario.
But you're right, I've got to overhaul my use of the term
"unbound".


Either that or you need to explain that you're using a different
meaning of the term.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 11 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
3
by: Dos Lil | last post by:
I have a unbound field in the subform(for calculating the datediff) which has the control property ==DateDiff("n",,). I have another unbound field in the main form which is for displaying the...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
10
by: Matthew Wells | last post by:
Hello. I've converted a bound Access 2000 form which displays data retrieved from an Access 2000 database to an unbound form. Now my hyperlinks don't work. I'm assuming it's because the form...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
0
by: TD | last post by:
I'm looking for input into my decision to switch to ADO and unbound forms. I get tired of having to block all of the ways a user can unknowingly save a record, like using the PageUp, PageDown keys...
6
by: Volker Neurath | last post by:
Hi all, I have a Problem with combobox-property "NotInList" and an unbound Form. The situation: On my main form i have three comboboxes for data-exchange (here: Names of distributor,...
0
NeoPa
by: NeoPa | last post by:
Introduction: We get fairly frequent questions on here about why settings (including both values AND formatting) of unbound controls on a form, are not stored for reference later, but instead, each...
11
by: jwessner | last post by:
I have a form (Form1) which contains basic Project data and a subform listing the personnel assigned to the Project as a continuous form. Selecting a person on that project and clicking on a command...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.