bound form and updates

8

85ascMcLaren

I normally use access like VB and use unbound forms, however I am in a
situation where it would be real quick and dirty to create a bound form for
my application. I need someone to explain something to me. I don't
understand the use of the command button for saving a record when everytime I
change anything on a field in a bound form, it is instantly updated in the
database which is what I DO NOT want. How can I make it so the user has to
click on the save button to save the record without the fields automatically
getting updated in the database while using the bound form....

Thanks,
Jason
 
G

Graham R Seach

Jason,

Yes, that's true; Access creates/updates a record whenever you close the
form or navigate to another record (assuming all pre-conditions exist).

To prevent that, you must disable the Close button (the CloseButton
property), disable auto navigation (the NavigationButtons property), and
then provide your own Close button and navigation buttons (if you use them).
Then write code to check the form's Dirty property, and if dirty, confirm
whether the user wants to create/update the record or Undo/Cancel it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
8

85ascMcLaren

You mention that it updates when you close the form or move to the next
record, but it is updating on me even when I just move to another field in
the same record. I wouldn't mind if it updates on the next record or on a
close, but on each field is a little ridiculous. Am I not seeing something
correct here....?

Thanks,
Jason
 
R

Rick Brandt

85ascMcLaren said:
You mention that it updates when you close the form or move to the
next record, but it is updating on me even when I just move to
another field in the same record. I wouldn't mind if it updates on
the next record or on a close, but on each field is a little
ridiculous. Am I not seeing something correct here....?

Either a) what you think is happening is not happening or b) you have writteen
code or macros to make it happen.

By default, there is nothing about an Access form that would commit the record
every time you change fields. In fact on many forms that would cause an error
because some required fields hadn't been populated yet.
 
G

Graham R Seach

Jason,

In addition to what Rick has said, if you have the primary key field visible
(and it is an Autonumber type), it may appear that the record has been saved
because you'll see the number that has been reserved for it. But as soon as
you start editing a record, a transaction is opened for it; the record will
not be saved until you close the form, move to another record, or move to a
subform.

Is it possible that the other "field" is actually sitting on a subform?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
8

85ascMcLaren

You are probably correct. I think I have a combo box controlling the display
of the records, so when you choose another combo box field, it is like moving
to another record which automatically updates the record. What can I do to
stop the update if the user selects another selection from the combo list ?
Something in the Form's dirty property maybe ?

Thanks,
Jason
 
R

Rick Brandt

85ascMcLaren said:
You are probably correct. I think I have a combo box controlling the
display of the records, so when you choose another combo box field,
it is like moving to another record which automatically updates the
record. What can I do to stop the update if the user selects another
selection from the combo list ? Something in the Form's dirty
property maybe ?

Exactly how is it "controlling the display of records"? If you have added a
ComboBox that navigates the form then it is not "like moving to another
recoord". It IS moving to another record. The user should not mess with that
control until moving to a different record is what they want to have happen.
This is no different than entering some data and then pressing one of the
navigation buttons. The user simply has to know how the form works and do
things correctly.

Have you clearly indicated that the ComboBox is for navigating and not for data
entry? ComboBoxes used for navigating should not be bound to any field. Is
yours unbound?
 

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