Results 1 to 10 of 10
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    click to a record (2000)

    Hello, I have a list box that displays outstanding cases on a form (form B, List [img]/forums/images/smilies/cool.gif[/img]. I need to be able to click on a case in the list then have the full case/record details appear in a seperate form (form main) which is already open.. The link is by a common numeric ID.

    Kind regards Darren.

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

    Re: click to a record (2000)

    You can use the On Click event of the list box (or the On Dbl Click event, if you prefer). For illustration purposes, I will use the following names. Replace them with the appropriate names in your code:

    List box: ListB
    Other form: MainForm
    ID field: CaseID

    Private Sub ListB_Click()
    With Forms![MainForm]
    .Filter = "[CaseID] = " & Me.[CaseID]
    .FilterOn = True
    End With
    End Sub

    The square brackets around a name are only necessary, strictly speaking, if the name contains spaces or unusual characters. If you use the On Dbl Click event, the first line becomes

    Private Sub ListB_DblClick(Cancel As Integer)

    The rest remains the same.

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: click to a record (2000)

    Thanks Hans

  4. #4
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: click to a record (2000)

    Hi, Ihave followed the routine but it is still not playing ball, this is my code

    Private Sub ListCase_Click()
    With Forms![frmMain]
    .Filter = "[refID] = " & Me.[list].Column(2)
    .FilterOn = True
    End With
    End Sub

    column 3 is where the ID sits on the list.

    Thanks Darren.

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

    Re: click to a record (2000)

    So what is wrong?
    - Do you get an error message? If so, which error message, and whoch line is highlighted if you click Debug?
    - Do you get an unexpected result? If so, what?
    - Does nothing happen at all?

  6. #6
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: click to a record (2000)

    It works but doesn't jump to the ID record I require.

    Thanks.

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

    Re: click to a record (2000)

    I'm sorry to keep on harping on this, but that is a very ambiguous answer. What do you mean by "it works" if at the same time "it doesn't jump to the ID record I require". Please try to be specific. <img src=/S/grovel.gif border=0 alt=grovel width=31 height=23>

  8. #8
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: click to a record (2000)

    Sorry, I am now at home and was working from memory on the problem which is at work. The message is
    runtime error 2465, microsoft access can find the field 'l' referred to in your expression.

    Kind regards Darren.

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

    Re: click to a record (2000)

    Now, that's great, isn't it, if Access can find the field <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Are you sure that refID is the correct field name?
    Is it possible that the 3rd column of ListCase - i.e. ListCase.Column(2) - is empty/null? You should be able to check that if you click Debug when the error occurs, by hovering the mouse pointer above ListCase.Column(2) in the code.

  10. #10
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: click to a record (2000)

    Resolved, it is named refId on the form but it's name on the table is referralID, I have changed it to referralId and it now works fine.

    Thanks Darren.

Posting Permissions

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