Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Record at top of continuous form? 1

Status
Not open for further replies.

emilybartholomew

Technical User
Aug 3, 2001
82
US
Hi-

Is there a way to have the new record be located at the top of a continuous form (as opposed to at the bottom, underneath all the existing records)?

Thanks,
emily
 
Hi,

I don't think so, but just thinking about your problem, as a possible work around...

What about 2 subforms? One above the other, both based on the same data, except, the top one properties are set to 'data entry' only. When the data is entered, the bottom subform get requeried!

Just a thought...Good Luck
 
Unfortunately, there is no easy, built-in way to do this. I too have wanted this feature at various times in the past, but Microsoft Access doesn't natively support it. The new record for Datasheets and Continuous forms will always be located at the bottom.

Although I haven't tried this idea, it should be possible to create a main form that isn't a Continuous form. You would lay it out to match the Continous form look and feel. Then you would have a subform that is your continuous form. You could set the main form to be dataentry only, meaning it only allows new records. Then set the sub form to not allow new records. You would have to write some code so that when a new record is added on the main form, the sub form is requeried so that the new record is visible. Might be worth a shot.

The only other real solution would be to use a 3rd party ActiveX grid control that supports the new record row being at the top. I am not completely sure, but I believe that the Janus Gridex 2000 control supports this.
Good Luck
 
It's easy. Just use a simple query as the record source for the form. The query will include all columns of the source table, but will also sort the records in reverse (descending) order. (I assume that there is a record number or date column that would provide that kind of a sort.) That way the most current records will be at the top of the records displayed on the form.

You might also want to add a button that will say "Add new record" and initially have the AllowAdditions property of the form set to No. When the user clicks on the Add button, change the property AllowAdditions to Yes (or True) and AllowDeletions and AllowEdits to No, and then go to a new record. The code for the OnClick property of the Add button would read something like this:

If me.cmdAdd.caption = "Add new record" then
me.cmdAdd.caption = "Edit records"
me.AllowAdditions = True
me.AllowEdits = False
me.AllowDeletions = False
DoCmd.GoToRecord acDataForm, "frmMyForm", acNew
else
me.cmdAdd.caption = "Add new record"
me.AllowAdditions = False
me.AllowEdits = True
me.AllowDeletions = True
me.requery
end if


The DoCmd.GoToRecord will move to a blank form to add a new record.
 
I tried using the pop-up form to add a new record, and it seems to be working. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top