Subform keeps returning to first record

slobberingdog

New member
Local time
Tomorrow, 00:31
Joined
Jul 8, 2011
Messages
3
Hi Guys,

Using Access 2003 - I have a main form with a tab control. The tab control has 5 pages - each page has a subform - each subform is linked to the next. ie: on page 1 the subform is linked to the main form, the subform on page 2 is linked to subform1 via a field on the main form and so on. This works really well for the subforms on pages 1 to4 of the tab control. The subform on the fifth page links ok,, and lets me add / edit one record - but when I try to add (click, tab, enter) a second record it jumps straight back to the first field on the first record.:confused:

I have manually added some records to the underlying table and they show up perfectly, however I can only edit the first record, not any of the others.

The only bit of code I have is in the double click event on one field on each subform which indexes to the next page, and therefore the next linked subform:

---
Private Sub Description_DblClick(Cancel As Integer)
Dim tabctl As TabControl
Set tabctl = Forms![Management Projects - Tabbed].TabCtl31
tabctl.Pages(4).SetFocus
End Sub
---

There is no code in any section of the subform I am having problems with, and no code in the main form at all.

I was hoping someone might be able to point me in the right direction.

Thanks in advance.

slobberingdog
 
Thanks for the warm (and prompt) welcome !! Much appreciated.

I have attached the database in a .zip file. It is very small and I'm hoping will be easily dissected.

The form that opens on start up is the main form - the tabs are in order from left to right - they are subforms that are linked via the fields at the bottom of the main form. The problem child is on the last tab on the right.

I did alot of searching through the various forums etc John, but to no avail. The example you have pointed out I couldn't see as relevant to my problem here.

I hope this all makes sense to someone !!! Let me know if I need to provide anymore detail.

Regards,

slobberingdog
 

Attachments

I took a look at your database. I had no problem added extra records to the fifth tab (Document Sub Details 2). Maybe I don't understsand your problem.

Chris
 
Hi,

Thanks for looking at my database - how frustrating that you had no issue.

When I go to that tab and try to add or edit a record; ie: if I click in any field in any record except the first one, the cursor jumps immediately to DocDet4ID in the first record. I can't add a record and I can't edit anything.

Can you think of anything that might cause this sort of issue ? I'm really stuck and it is the last piece of the puzzle for me in this database...

Thanks again for taking a look.

Cheers,

Craig
 
...if I click in any field in any record except the first one, the cursor jumps immediately to DocDet4ID in the first record.
You need to go into the Code Module for your Form your errant Subform is based on (<Ctrl> + <G> from Form Design View) and find the Form_Current sub. It fires anytime you move from Record to Record, and code there must be Requerying the Form, which does the very thing you're describing, moves you back to the first Record.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom