setting cursor to new record

  • Thread starter Thread starter Roelof
  • Start date Start date
R

Roelof

Guest
Hi,

I have a form with a subform. Almost everytime I open the form I enter data in a new record on the subform. This worked fine until I got so many records that I have to scroll down everytime.

On opening the form I want the cursor to be in the second field of the new record in the subform.

I was able to change the start field for the cursor by changing the tab order, and now I’m looking for a way to set the cursor to the new record.

I would like to keep the order of the records the same (by date, new record is the last record) and I would like to keep the last 20 records visible if posible.

It looked so simple, but I’m afraid that I cann’t solve this alone. Any ideas?

Roelof
 
Code:
Cont.SetFocus
Cont.SelLength = 0
Where Cont is the name of the second field.
 
Continuous subform must open at the bottom.

I'd like to ask what I think is the same question. How in a long continuous subform in chronological order do you make the subform open showing the last records instead of always opening at the top?

I tried the solution posted above in the subform's OnLoad event, but it did not work, the first record got the focus.
 
I have an extra complexity. Buttons on the subform changes its recordsource property as required, so I'd like for each change in recordsource, to show the last/bottom records instead of the top. I tried the following code in the OnLoad event, and it works there, but only at the initial Load of the subform. Then I tried putting it in the OnFilter event, but it does do anything there at all.

Code:
DoCmd.GoToRecord , , acLast
 
But even if that works, and I think I know how to do it now, going to the last record:

By putting the GoToRecord in every cmd_Click event for the change of RecordSource,

New Question: how to show the last 8 - 10 records, instead of only the last one?
 
PierreR said:
I'd like to ask what I think is the same question. How in a long continuous subform in chronological order do you make the subform open showing the last records instead of always opening at the top?

I tried the solution posted above in the subform's OnLoad event, but it did not work, the first record got the focus.

You are saying the form is continious then possibly the 'field' is the same field just the second record. When you say field are you talking about a textbox, etc? To move to the second record use:
Code:
DoCmd.GoToRecord , , acGoTo, 2


If I'm wrong about that:
What is the name of the second field where did you put the code exactly in the form's load event? Do you have something after it that might cause it to loose focus. It should work.

I think you may be a bit confused tell me more what you are trying to do rather than solely focusing on the field.
 
Sorry I thought I was answering the original person. Now I'm confused. :confused: :o
 
Thanks for helping, dt01pqt. But I am not the original poster

I don't want to go to a specific field like the original poster, but want to see the last 8 records in the subform, when it opens. That is probably the second part of what he wants.

There was nothing else in the form's load event.

As explained above I used GoToRecord ,,, acLast on open, but then it shows only the last record and not the last page of records.

The other complexity is that my subform is requeried by changing the recordsource on the fly with 6 different buttons. Each time the recordsource changes, the subform should show the last page of the long list of records.
 
Sorry guys, but I thought my question was so similar that I thought it would be inappropriate to create a new thread. Now it has become inappropriate anyway, because my discussion is all over someone else's thread.
 

Users who are viewing this thread

Back
Top Bottom