Gustav Brock
gustav at cactus.dk
Tue Jun 29 10:01:32 CDT 2004
Hi Kostas
> I am trying to open a form based on a list box criteria with a double click.
> the list box is linked to a table: SELECT MT_basic_char.AM FROM
> MT_basic_char;
> What I want to do is on doulble click to open the main form MT_basic_char
> based on the line's AM I double click
> I use the follown but it always just open the first record and not the
> filter one I have chosen via double click
> Private Sub list2_DblClick(Cancel As Integer)
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "MT_basic_char"
> DoCmd.OpenForm stDocName, , , stLinkCriteria
> stLinkCriteria = Me!list2 = Forms!mt_basic_char!AM
>
> End Sub
I think you have mixed it up a bit ... you must define your criteria,
then open the form:
stDocName = "MT_basic_char"
stLinkCriteria = "[AM] = " & Me!list2.Value & ""
- or if AM is a String:
stLinkCriteria = "[AM] = '" & Me!list2.Value & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
/gustav