Dan Waters
dwaters at usinternet.com
Fri Aug 19 08:47:45 CDT 2005
Tina - you are most welcome. Dan Waters -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Tina Norris Fields Sent: Friday, August 19, 2005 8:23 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] New Record Appearing on Top 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 > > > > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com