Insert a New Record at the top of a subform

ijswalker

Registered User.
Local time
Today, 14:49
Joined
Jun 16, 2008
Messages
67
Hi,

I have managed to create a button that when clicked will GetFocus and allow me to enter a new record at the bottom of a subform. However, I would like to be able to enter the new record at the top of the subform. Any Ideas?

Thanks

Ian
 
Hi,

I have managed to create a button that when clicked will GetFocus and allow me to enter a new record at the bottom of a subform. However, I would like to be able to enter the new record at the top of the subform. Any Ideas?

Thanks

Ian


In form design, go to View/Tab Order and make sure the first field of your form is moved to the top of the Custom Order list.

Mike
 
Insert New Record at the top of a subform

Thanks Mike,

The solution you suggest allows the records to be sorted after data input. I would like the blank line for a new record to be entered to appear at the top of the subform

Here is the Code for selecting a new record.

Private Sub Command44_Click()
Me.D_DETAIL_SERVICE_subform.SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub

Is there a way that once the new record data entry has been activated I could then get the row to appear at the top of the form before entry has begun.

e.x.

New Record (AutoNumber) (Record not yet entered)
Record 1
Record 2
Record 3

At the moment when I run the above code it looks like this


e.x.

Record 1
Record 2
Record 3
New Record (AutoNumber) (Record not yet entered)

Thanks

Ian
 
In a word, no. The 2 workarounds I've seen done are:

1) 2 subforms, 1 in data entry mode sized for 1 record, with a second subform underneath it displaying the rest of the records.

2) unbound textboxes above the subform, with code to add the record.
 
Hi Mike,

I like the idea of another subform at the top. From the code above to select the new record - How do I exclude the records and only show the new record line in the subform when I click the command button?

Thanks

Ian
 
Was that meant for me? If so, set the Data Entry property of the top subform to Yes.
 
Sorry Paul,

Yes, that was meant for you and thanks for your help. I really appreciate it as I do Mike's help also.

Cheers

Ian
 
No problem. You may want to requery the bottom subform in the after insert event of the top one so the just-added record will appear there.
 

Users who are viewing this thread

Back
Top Bottom