MartinR wrote:
> Hi,
> I have written this code below and it executes but does not do what I
> want it to do. What I want is the form "Sparesform" to open when I
> double click on the "index" field for the record I wish to view. The
> index field is part of a subform. What is happening at the moment is
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/12605-problem-displaying-specific-record.html
> the form "Sparesform" is opening but does not go to the correct record
> but instead goes to, what appears to be a new record. My where
> condition of the code appears to be assigning the correct index number
> to "forms![sparesform]![number]" but this does not seem to be carried
> out when the sparesform is opened.
>
> Index is a numeric data type (ie its an auto number)
> Can you shine some light on my problem.
>
>
> Private Sub index_DblClick(Cancel As Integer)
>
> Dim stDocName As String, stLinkCriteria As String
>
> stDocName = "Sparesform"
> stLinkCriteria = "forms![sparesform]![Number] = " & Me![index]
>
> DoCmd.OpenForm stDocName, , , stLinkCriteria
> Forms![sparesform]![Condition].SetFocus
>
> End Sub
>
> Yours truly,
> Martin R
Your where clause does not need to refer to the form like that (the form
knows who it is). Just use...
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=12605
stLinkCriteria = "[Number] = " & Me![index]
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com