Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Find Record based on Query Value (2002)

    Hi,

    I have form that is bound to a query. The desired record in the form is found by clicking a name in [lstName] using the SQL [froms]![frmNameLookup]![lstName]. This is working fine. What I need is to have the form open to a new record if no name is chosen from the list or if the list is null. I'm not sure how to write this in the query or if it is even possible.

    Thanks,
    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Find Record based on Query Value (2002)

    Is "form that is bound to a query" the same as frmNameLookup?

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Find Record based on Query Value (2002)

    Hi Hans,

    No, the form that is bound to the query is frmFaceSheet. frmNameLookup is used to hold the list of people's names, social securty numbers and status. The user double clicks lstName on frmNameLookup and the frmFaceSheet opens to that client. That piece works fine. I need it to open to a new record if no one is chose from lstName.

    Leesha

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Find Record based on Query Value (2002)

    You don't do that in the query, but in the On Dbl Click code. Try this. Post back if it doesn't work correctly.

    Private Sub lstName_DblClick(Cancel As Integer)
    If Me.lstName.ListIndex = -1 Then
    ' no name selected - open form to new record
    DoCmd.OpenForm FormName:="frmFaceSheet", DataMode:=acFormAdd
    Else
    ' name selected - just open form
    DoCmd.OpenForm FormName:="frmFaceSheet"
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •