Entering data after pushing button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK,
I have serveral forms with several fields to be filled by user has he goes
along.
My problem is this, imagine the user is in field 3 of a form with 5 fileds.
Then he realizes we doesn't want to enter this data, and wants to close the
form.
In my aplication as soon as he starts to fill field 1 Access starts to write
it in the associated table, leaving the rest of the fields to be completed.
Is there a way to prevente this from happening? I would like some sort of
button that only after the user pushes it, would then record the data in the
Table.
Is this possible?
Thanks in advanced.
 
Moving on:
I'm now using the following code that works fine, just a litlle twist I
would like to alter:

If MsgBox("Do you want to save the changes?", vbYesNo,"Confirm Change")
= vbNo Then
Cancel = True
Me.Undo
End If

how do I prevent the next message after the user clicks in the (NO) button,
something
like "You can't save this record at this time. ... blablabla...do you want
to close the database object anyway?"

How do I prevent Access from showing that warning? I just adds confusion to
unexperinced users.

Thanks
 
<<as soon as he starts to fill field 1 Access starts to write it in the
associated table,>>

Most likely that is not true. Access saves a record:
1. When you move to a new record
2. When you close a form
3. When you explicitly tell Access to save a record via code

If you have not done one of the above three things after entering data in
one or more fields, you can erase all your data and NOT SAVE anyhting you
entered by executing the code:
Me.UnDo

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Private Sub Form_BeforeUpdate(Cancel As Integer)

If MsgBox("Deseja salvar este registo?", vbYesNo, "Confirmar Alterações")
= vbNo Then
Cancel = True
Me.Undo
End If

End Sub
 
I assume you are getting this error when trying to close the form, add this
code to the form OnError event

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2169 Then Response = acDataErrContinue
End Sub
 
Back
Top