Code problem!!!

  • Thread starter Thread starter alpapak via AccessMonster.com
  • Start date Start date
A

alpapak via AccessMonster.com

Code problem!!!
------------------------------------------------------------------------------
--

hi
i have a form [Customers] (continiousform) and when i doubleclick the surname
of a customer, the form [Details] (single form) open
until here everything is ok
the problem is that the code i use open [Details] and use [SurnameID] as a
filter
i want to be able to open [Details] and see all records, but to focus on my
[SurnameID]


Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details", , , "[SurnameID] = " & Me.SurnameID
DoCmd.Close acForm, "Customers", acSaveNo
End Sub

thxs
 
Alpapak,

Here's one way...

Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details"
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub
 
thxs a lot

Steve said:
Alpapak,

Here's one way...

Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details"
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub
Code problem!!!
------------------------------------------------------------------------------
[quoted text clipped - 15 lines]
 
i get an error

Run-Time Error '2110':
Ms access can't focus

Property Enable = True
Property Locked = False
---------------------------------------------

Steve said:
Alpapak,

Here's one way...

Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details"
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub
Code problem!!!
------------------------------------------------------------------------------
[quoted text clipped - 15 lines]
 
Alpapak,

Is SurnameID the name of a textbox on the Details form? Is the Visible
property set to Yes?
 
SurnameID is a textbox on the Details Form and Visible Property is yes

Steve said:
Alpapak,

Is SurnameID the name of a textbox on the Details form? Is the Visible
property set to Yes?
i get an error
[quoted text clipped - 4 lines]
Property Locked = False
---------------------------------------------
 
Alpapak,

Hmmm, it works ok for me, so not sure at this stage. Can you try a
couple of experiments?...

Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details"
DoCmd.SelectObject acForm, "Details"
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub

or...
Private Sub Surname_DblClick(Cancel As Integer)
DoCmd.OpenForm "Details"
Forms!Details.SetFocus
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub

or...
Private Sub Surname_DblClick(Cancel As Integer)
Me.Visible = False
DoCmd.OpenForm "Details"
Forms!Details!SurnameID.SetFocus
DoCmd.FindRecord Me.SurnameID
DoCmd.Close acForm, Me.Name
End Sub

--
Steve Schapel, Microsoft Access MVP
SurnameID is a textbox on the Details Form and Visible Property is yes

Steve said:
Alpapak,

Is SurnameID the name of a textbox on the Details form? Is the Visible
property set to Yes?

i get an error

[quoted text clipped - 4 lines]
Property Locked = False
---------------------------------------------
 
Back
Top