Question on new records

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

Guest

Hallo

I hope some one can help is there some thing like a ADD query I seen the
normal select query, update, append, delete, and so on but I need I query
where I can add query to a new record.
What I am trying to do is I have a form where you can enter a few things but
I don’t want it to be enter directly into the table I want it only entered
into the table once the user clicks on a OK button on the form. Any ideas how
this is possible because what happens at the moment they enter data and then
by accident scroll to a new record and enter the info double so my idea to
not link the form to a table or query and do it all by an ADD query.

Thanks for the help

Markus
 
First, an Append Query is what you're asking for. However, there is
probably an easier way. If you want to prompt the user before saving changes
on the form to the table, use the BeforeUpdate event of the form to open a
message box asking them. If they reply No, then Cancel the update. This
would allow you to leave the form as a bound form. If the user wants to undo
the changes after they reply No, then just need to press the Esc key twice.

Example:
If Msgbox("Save Changes?", vbYesNo + vbQuestion) = vbNo Then
Cancel = True
End If
 
Hi Wayne - this post helped me with a similar question - I've added the code
for the forms 'before update' which works fine. I've also added an OK button
to my form - if the fields are completed without tabbing past the last field
the person just clicks the ok button - i used the commandbutton wizard to
make this a saverecord button so when it is clicked the code for the msgbox
runs, which is fine, it's just making sure the person wants to add the record.

My problem is that if I open the form and just click ok without entering
anything or if i don't choose an item in a list box that is on the form the
form simply closes - I would like it to give an errorbox or something - how
might I do this?

Thanks

TDR
 
If the user hasn't made any changes, then the form won't be "dirty". So you
should be able to test for that in your code.

Example:
If Not Me.Dirty Then
MsgBox "Please make a selection."
Cancel = True 'this will depend on which event you have this in
Exit Sub
End If
 
Back
Top