Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2005
    Posts
    44

    Unanswered: double linking fields

    In order to allow the use filter out details displayed on a form. I've created a form which act like a diaglogue box but has two combo boxes which the user must choose a field from each.

    In order to go to the record on the details forms i have the following code to link the info together.

    Private Sub cmd_edit_Click()
    On Error GoTo Err_cmd_edit_Click

    Dim stDocName As String

    Dim stLinkCriteria As String
    stDocName = "details_form"

    stLinkCriteria = "[combo1]=" & Me![id1]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_cmd_edit_Click:
    Exit Sub

    Err_cmd_edit_Click:
    MsgBox Err.Description
    Resume Exit_cmd_edit_Click

    End Sub

    anyone got any ideas on how i can adapt this so it looks at both combo boxes and then opens the details dependant on both of these.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    stLinkCriteria = "[combo1]=" & Me![id1] & " AND [combo2]=" & Me![id2]
    ???
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2005
    Posts
    44
    good idea, but is displays a type mismatch error when i do that

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Your original code works fine?

    What is the data type of "combo2"?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Apr 2005
    Posts
    44
    works fine, but obviously only looks at one set of the data.

    combo2 is a number between 1975 and 9999

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    could you post your code as it is now?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Apr 2005
    Posts
    44
    mmmm its working fine now... how odd i didnt change anything! all i did was go into another room!!! access is out to get me today i thinks!

    Thanks for you help

  8. #8
    Join Date
    Apr 2005
    Posts
    44
    hey,
    So i've done the double linking fields.... but is it possible to do triple linking?
    stLinkCriteria = "[combo1]=" & Me![id1] & " AND [combo2]=" & Me![id2] & " AND [combo3]=" & Me![id3]

    ive tried this but it dont wanna work.... any ideas

  9. #9
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    It most certainly is. You can concatenate as many critereon as you like with the AND operator.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  10. #10
    Join Date
    Apr 2005
    Posts
    44
    would there be any blindingly obvious reasons why it would work? it keep throwing up the parameter entry box every time

  11. #11
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    parameter prompts come into play when you're asking access to use a field or control that doesn't exist...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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