Dan Waters
dwaters at usinternet.com
Tue Aug 16 08:48:20 CDT 2005
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