[AccessD] New Record Appearing on Top

Tina Norris Fields tinanfields at torchlake.com
Fri Aug 19 08:23:10 CDT 2005


Dan, that is great.  I often have my subform records sorted in 
descending order, but I never knew how I could make the new record 
appear to be at the top while it was being created.  Thank you.  I have 
a new tool.
Tina Norris Fields

Dan Waters wrote:

>Julie,
>
>Yes - and it's a nice feature.  
>
>The way to do this is to create fields directly above the subform container
>that mimic the fields in the continuous form.  These fields will be unbound.
>A user will fill in these fields and push a Save button when done.  The save
>button will cause the data in the unbound fields to be inserted into the
>table behind the subform.  If your subform is sorted in descending order by
>it's autonumber field, then the new record will display at the top of the
>subform.
>
>I use this method in an hours tracking database.  The Save button's click
>event code is shown below:
>
>Private Sub butSaveHours_Click()
>    
>    Dim stgSQL As String
>    
>    stgSQL = "INSERT INTO tblHours (ClientID, Category, SubCategory, Hours,
>ActivityDate, Description)" _
>        & " VALUES (" & txtClientID & ", '" & cboCategory & "', '" &
>cboSubCategory & "', " & txtHours & ", '" & txtActivityDate & "', '" &
>memDescription & "');"
>    DoCmd.SetWarnings False
>    DoCmd.RunSQL stgSQL
>    DoCmd.SetWarnings True
>    
>    cboCategory = Null
>    cboSubCategory = Null
>    txtHours = Null
>    txtActivityDate = Null
>    memDescription = Null
>
>    Me.Refresh
>    
>    cboCategory.SetFocus
>    butSaveHours.Enabled = False
>    
>End Sub
>
>Note that the ClientID field is the Primary Key for the main table and is
>also the Foreign Key for the related sub table.
>
>HTH,
>Dan Waters
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Julie
>Reardon-Taylor
>Sent: Tuesday, August 16, 2005 8:35 AM
>To: accessd at databaseadvisors.com
>Subject: [AccessD] New Record Appearing on Top
>
>I have seen this question posted before and cannot remember the response.  A
>
>client has asked that the "new" record in a continuous form appear at the 
>top.  I know that Access doesn't work that way.....but is there a way to do 
>this?
>
>
>
>Julie Reardon-Taylor
>PRO-SOFT OF NY, INC.
>44 Public Square Suite #5
>Watertown, NY 13601
>Phone/Fax: (315) 785-0319
>www.pro-soft.net
>
>
>  
>





More information about the AccessD mailing list