moving through records and updating sub forms

Tezdread

Registered User.
Local time
Today, 22:41
Joined
Jul 11, 2002
Messages
105
hi all,

I have this database I'm working on and have a couple of issues I can't work out.

The first is this, I want to have my sub forms go to the last record when moving through the main form, currently I can only get this to work when I open the form?

If I move through the records in my main form (forward and backwards), the two sub forms go to the first record only, so how can I get them to go to the last recor?

I've attached the DB to show you what I mean.
Thanks in advance
Tez
 

Attachments

Right so on your main form "tblProcMaster" you want the records on both the "Review Details" & "frmVersionControl" to go to the last record.

Example would be "frmVersionControl" goes to record "2" and "Review Details" goes to record "2" is this want you need to happen.

Alastair
 
thanks alastair69,

apart from specifying the record number ('2') I think you have it. The problem with using the record number is that it will change over time as more reviews are carried out and new versions are entered. For this reason it would need to go directly to the last record
 
Hi, is there anyone that can help me with this?

I got this code from another site but it gives an error and when I tried to get help I couldn't...

This is the code that I was told would work
Code:
Private Sub Form_Current()
   Dim frm As Form, sfrm1 As Form, sfrm2 As Form
   
   Set frm = Forms![frmProcMaster]
   Set sfrm1 = [frmReview].Form
   Set sfrm2 = [frmVersionControl].Form
   
   'SubForm1
   [frmReview].SetFocus
   
   If Not sfrm1.NewRecord Then
      DoCmd.RunCommand acCmdRecordsGoToLast
   End If
   
   frm.SetFocus 'set focus back to MainForm

   'subForm2
   [frmVersionControl].SetFocus
   
   If Not sfrm2.NewRecord Then
      DoCmd.RunCommand acCmdRecordsGoToLast
   End If
   
   frm.SetFocus 'set focus back to MainForm
   
   Set sfrm1 = Nothing
   Set sfrm2 = Nothing
   Set frm = Nothing
End Sub

the error I get is this

Run-time error '-2146500594 (800f00e)':

Method 'Form' of object '_Subform' failed


and relates to:
Code:
Set sfrm2 = [frmVersionControl].Form

I have checked the names and they are definitely correct. can anyone help me out?
 

Users who are viewing this thread

Back
Top Bottom