Forms

  • Thread starter Thread starter bruce
  • Start date Start date
B

bruce

hi
Imagine we have form based on a table. If we change
anything on form would directly change data on table.

Can we have the form, where user can change information in
form without being changed in table until they press a
button? So basically they have options of to save changes
or not save the changes and leave it the way it was.

Thank you
 
Bruce

Don't bind the control to the field in the form's recordsource. When you
leave the field unbound, the word "Unbound" shows up in the field (on most
controls) in design view.

In order to get the data saved, you will have to create an APPEND query to
move the data to the table.

Other factors you will have to consider is the validation of the data and
whether duplicate information is being added to the table.

Now, with that said..... Have you considered the use of the BeforeUpdate()
event (when you have the fields bound a field in the recordsource)? This
event allows you to do any validation checks. If something is not correct,
you can cancel the updating of the record, thus, no data is saved to the
table.

HTH

--

Rob

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Need to launch your application in the appropriate version of Access?
http://www.fmsinc.com/Products/startup/index.asp

Need software tools for Access, VB, SQL or .NET?
http://www.fmsinc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
The change isn't saved until you move to a different record or close the form. However, to
answer your question; yes, you can.

You can place a button on the form, but it may be easier just to prompt the user in the
Form's BeforeUpdate event.

Example:
If MsgBox("Save Changes?", vbYesNo + vbQuestion) = vbNo Then
Cancel = True
If MsgBox("Cancel Changes?", vbYesNo + vbQuestion = vbYes Then
Me.Undo
End If
End If
 
Yes, this is called an unbound form. It is a lot more work, but it can be
done:

1. Build your form with all the necessary fields from the table, as controls
on the form.

2. Write a SQL statement and build a recordset which returns a single record
from the table, setting the controls in the form = to the fields in the
recordset.

3. Build a Save button to write the databack to the table, using another SQL
statement or a recordset AddNew or Edit method.

--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top