When does data entered in form appear in underlying table?

C

Chrisso

Hi All

I have a form that sits straight on top of a table. I enter new records
by hitting the ">*" button for a new record and then filling out the
fields.

Can anyone tell me when this record will appear in the actual table?

It seems to appear after the form is closed but I want to run an append
query on the newly added record before I close down the form but at
this stage the info I have entered does not appear in the underlying
table.

Can I make some sort of commit call to force this new record into the
table so that I can then run my query to append that data to another
table? Or is this bad practice?

Chrisso
 
S

strive4peace

Hi Chrisso,

the record is written automatically when you move off it -- to another
record or close the form.

You can force the record to save to the disk by clicking on the pencil
icon that appears in the record selector area to the left as you start
typing.

You can also use code to see if a record needs to be saved and, if so, do it

'~~~~~
'save record if changes have been made
If me.Dirty Then Me.Dirty = false
'~~~~~

If you are going to run an Append query in code, make sure you do this
afterward:

currentdb.tabledefs.refresh
DoEvents

so that other processes/users see the changes

~~~

btw, please do not post the same question into different newsgroups,
this question is also posted in microsoft.public.forms


Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
T

Tony Toews

strive4peace said:
the record is written automatically when you move off it -- to another
record or close the form.

Actually the record is not always saved when you close the form. If
there are field level constraints, such as required field, then
closing the form using the standard command button will not display
that error message and not save the record.

Thus I would certainly agree with using other methods such as you
state to ensure either the record is saved or that any messages which
stop the record from being saved are displayed.
If you are going to run an Append query in code, make sure you do this
afterward:

currentdb.tabledefs.refresh
DoEvents

so that other processes/users see the changes

Did you mean Append query or MakeTable query?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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