Switch tabs & go to corresponding record

_Nickel_

Registered User.
Local time
Today, 13:26
Joined
Nov 11, 2003
Messages
31
All of my forms are subforms on different tabs of my main form.
What I want to do is switch to another tab and open a corresponding record (they are related through a 1:n relationship where the 1-side is the tab I want to switch to).

This is what I tried but it doesn't work:

Private Sub SoftwareIDfk_DblClick(Cancel As Integer)

Dim buffer As String
Dim rst As Recordset

buffer = Form_sfrmSoftware.SoftwareIDfk.Value
Form_frmMain.frmSoftware.SetFocus
Me.SoftwareID.SetFocus
DoCmd.FindRecord FindWhat:=buffer
Form_frmSoftware.Refresh

End Sub

Can anyone tell me what I did wrong? It works as far as getting to the SoftwareID field, but then I need to change to the record I am looking for

Thanks
 
You don't need the Refresh part, get rid of it
something like
DoCmd.FindRecord (buffer)
 
Thanks, it works now!

The only thing I don't get is that when I use:
Me.SoftwareID.SetFocus

it gives me an error while when I use:

Me.SoftwareIDfk.SetFocus

it works although the field I want to focus on is the SoftwareID field (and not a foreign key (it's name is SoftwareID)
:confused:
 
Change the Name of the control to something other than the field name
 

Users who are viewing this thread

Back
Top Bottom