Add Query

  • 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 q 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
 
A couple ideas on other ways to accomplish this.

First, set the form's Cycle property to "This record only".

Next, add code to the form's BeforeUpdate event and to the <Save> command
button. In the <Save> button code, set a flag that it is OK to save, then
save. In the BeforeUpdate code, check for the flag -- if it isn't set,
cancel the update. If it is set, reset it.

Good luck

Jeff Boyce
<Access MVP>
 
Thanks Jeff

Is it possible that you could give me the code that i need to enter
beforeupdate event and the code i need for the Save Command it would be
greate help im not a VB expert at all

Markus.
 
Markus

I'll offer that I'm no VB expert either, and suggest that the only way
you'll gain experience is to ... gain experience!

You could dimension a boolean (for the flag) for the entire form module, and
then set its value in the Click event of the <Save> button, perhaps
something like (actual syntax may vary):

Dim mblnOKtoSave as Boolean

and

blnOKtoSave = True

The form's BeforeUpdate event comes with a Cancel setting, so you might use
(again, your syntax may vary):
...
If blnOKtoSave =False
Cancel = True
End If
...
... (your code to close the form)
 
Back
Top