Form question

J

JAJansenJr

I'm - really - new to Access 2007. I have a simple database and
a form that allows me to enter data. When I finish entering the
form I don't see the new record in the database until I close
and then reopen the database.

I'd like to have a button on the form which, when clicked,
would enter the information into a new record and display
it in the database without closing and reopening the
database.

Any suggestions/advice/pointers to tutorials/etc sincerely
welcome.
 
B

Brendan Reynolds

JAJansenJr said:
I'm - really - new to Access 2007. I have a simple database and
a form that allows me to enter data. When I finish entering the
form I don't see the new record in the database until I close
and then reopen the database.

I'd like to have a button on the form which, when clicked,
would enter the information into a new record and display
it in the database without closing and reopening the
database.

Any suggestions/advice/pointers to tutorials/etc sincerely
welcome.


There's a Save Record icon on the Ribbon (in the Records section on the Home
tab) or you can use the keyboard shortcut Shift+Enter. If you want to add
your own command button, in form design view, make sure that Use Control
Wizards is selected (highlighted) in the Controls section on the Design tab
of the Ribbon, place a command button on the form, select the second option
in the Categories list in the command button wizard, and select Save Record
in the Actions list. This will create an embedded macro to save the record.
If you'd prefer to use VBA, unselect the Use Control Wizards option (or just
click Cancel when the wizard appears). Place a command button on your form
and right-click it. Choose Build Event from the shortcut menu, then Code
Builder in the Choose Builder dialog box, and enter the following line of
code in the event procedure ...

DoCmd.RunCommand acCmdSaveRecord
 
J

JAJansenJr

That's a very helpful reply. I remain unclear as to why I have to
close the table and reopen it to see the newest record(s)
displayed. Surely there would be a refresh command in Access
or other way to get a fresh display of the table. Any ideas on
that? Thanks for the other information.
 
J

John W. Vinson

That's a very helpful reply. I remain unclear as to why I have to
close the table and reopen it to see the newest record(s)
displayed.

You don't.
Surely there would be a refresh command in Access
or other way to get a fresh display of the table.

There is.
Any ideas on
that? Thanks for the other information.

Press F1 and search for "Requery" and "Refresh". The F9 key requeries whatever
table or form is active, or you can of course do it programmatically.
 

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