Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / December 2005

Tip: Looking for answers? Try searching our database.

add a record subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amanda Byrne - 29 Dec 2005 14:56 GMT
I have a individual account form with two subforms, both attached to my
Journal table.  The purpose of the top subform is to add a journal record,
and the purpose of the bottom subform is to list the journal record entries
for edit or deletion in descending order by date.  

(I created the layout this way so that the user can enter new journal
records without scrolling to the bottom of the list to enter a new record)

This method still has two problems

1. I have created an "Add" button in the top subform to officially "enter"
the record, but when this button is clicked, I would also like to refresh the
bottom subform to show the newly entered record.

2. If the user presses the tab button after entering a new journal record,
the record is entered automatically.  I only want the record to be entered
when the user presses the "Add" button.

Please be clear with any code suggestions, as I'm and not very used to
writing code in Access (I'm used to doing VB code for ASP websites)

Thanks, Amanda
John Vinson - 29 Dec 2005 22:59 GMT
>I have a individual account form with two subforms, both attached to my
>Journal table.  The purpose of the top subform is to add a journal record,
[quoted text clipped - 16 lines]
>Please be clear with any code suggestions, as I'm and not very used to
>writing code in Access (I'm used to doing VB code for ASP websites)

I'd suggest setting the properties of the upper subform to:

Data Entry = Yes
Allow Deletions = No
Cycle = Current Record

This will display *only* the empty "new" record or the record that has
just been added; and when the user tabs through the last control in
the tab order it will cycle back to the first rather than saving the
record and going on to a NEW new record.

In the first subform's AfterInsert event put the following line of
code. Click the ... icon by the After Insert event and invoke the Code
Builder; Access will give you the Sub and End Sub lines automatically.
You can also put this line of code in the Add button's Click event
instead, but the AfterInsert event will always fire whether the user
uses the add button or hits Ctrl-Enter or otherwise saves the record:

Private Sub Form_AfterInsert()
Parent!secondsubformname.Requery
End Sub

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.