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 PCname_DblClick(Cancel As Integer)
Dim buffer As String
Dim rst As Recordset
buffer = Form_sfrmWorkstationToPC.PCID.Value
Form_frmMain.frmPC.SetFocus
Me.PCID.SetFocus
DoCmd.FindRecord (buffer)
End Sub
When I run this code I get the following error message:
Run-time Error '2110'
Microsoft Access cannot move the focus to the control PCID
I am using the same code on other tabs of my main form and it works there but only if the focus is already on the ID field in the form that I want to switch to. If it's not Access just switchs tabs without going to the record that I want it to go to (but I get no error message
Please tell me what I am doing wrong!
Thanks
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 PCname_DblClick(Cancel As Integer)
Dim buffer As String
Dim rst As Recordset
buffer = Form_sfrmWorkstationToPC.PCID.Value
Form_frmMain.frmPC.SetFocus
Me.PCID.SetFocus
DoCmd.FindRecord (buffer)
End Sub
When I run this code I get the following error message:
Run-time Error '2110'
Microsoft Access cannot move the focus to the control PCID
I am using the same code on other tabs of my main form and it works there but only if the focus is already on the ID field in the form that I want to switch to. If it's not Access just switchs tabs without going to the record that I want it to go to (but I get no error message
Please tell me what I am doing wrong!
Thanks