Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Mar 2007
    Posts
    91

    Unanswered: Linking forms based on 2 criteriaz

    Hi guys
    I'm tryin 2 access a form based on the results found but i keep gettin type mismatch (error) & it doesn't specify exaclty where's d error
    Pls c ma code:

    stLinkCriteria = "Customercode = " & Me![CombCustCode] And "customername = " & Me![CombCustName]

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Your custname field is probably a text field, not a numeric field, therefore it needs to be enclosed in quotes in your search criteria...
    stLinkCriteria = "Customercode = " & Me![CombCustCode] And "customername = '" & Me![CombCustName] & "'"
    Inspiration Through Fermentation

  3. #3
    Join Date
    Mar 2007
    Posts
    91
    Thanks 4 repondin Red but unfortunately i still get d same error msg... the're both text boxes (customer name and code)

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Then you need to enclose the other field in single quotes the same way I did the second field
    Inspiration Through Fermentation

  5. #5
    Join Date
    Mar 2007
    Posts
    91
    still get d same eror msg. am not sure if ol ma quotes r where they're suppose 2 b

    stLinkCriteria = "Customercode = '" & Me![CombCustCode] & "'" And "customername = '" & Me![CombCustName] & "'"

  6. #6
    Join Date
    Mar 2007
    Posts
    91
    Could d problem b bcoz the customer name is not a unique name but the customer code is unique cos when i search for only the customer name i can link to the next form but when i use only the customer name i get an error msg sayin tha there's a syntax error

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    You now have too many double quotes in your string. Thats why your error message changed to "Syntax Error". Worst case, try some trial and error, and step through your code until strLinkCriteria works properly.
    Inspiration Through Fermentation

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Note to noks - Please learn both grammar and spelling <3
    George
    Home | Blog

  9. #9
    Join Date
    Mar 2007
    Posts
    91
    I seem to be getting another error.

    Here'e my code.

    stLinkCriteria = ("[Customercode] = '" & Me![CombCustCode] & "' AND [unique_id] = '" & Me![combunique_ID] & "'")
    MsgBox "[" & stlinkcriretia & "]"

    It gets executed fine but after that the next / linked form won't open, i get this error msg

    "The openForm action was cancelled"

    Can u kindly help as i don't understand why the action would be cancelled

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    stLinkCriteria = "([Customercode] = '" & Me![CombCustCode] & "' AND [unique_id] = '" & Me![combunique_ID] & "')"

    your brackets appear incorrect.
    George
    Home | Blog

  11. #11
    Join Date
    Mar 2007
    Posts
    91
    It doesn't make any difference. I've even gone to an extent of taking them out but i still get the same error msg.
    I've used the msgbox... to trap the stlinkcriteria results and i get some kind of block so i can't even tell my results

    I've ran out of ways of doig this

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Reminder:
    Quote Originally Posted by georgev
    Note to noks - Please learn both grammar and spelling <3
    And
    Quote Originally Posted by noks
    stLinkCriteria = ("[Customercode] = '" & Me![CombCustCode] & "' AND [unique_id] = '" & Me![combunique_ID] & "'")
    MsgBox "[" & stlinkcriretia & "]"
    See anything wrong here?
    Last edited by gvee; 03-26-07 at 08:18.
    George
    Home | Blog

  13. #13
    Join Date
    Mar 2007
    Posts
    91
    ??? I took out the brackets

  14. #14
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    The text that was highlighted in bold I have now highlighted in red also.

    Notice that you have spelt stLinkCriteria incorrectly.
    George
    Home | Blog

  15. #15
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I noticed that you are now using a field called unique_id. Is that a number field or a text field?
    Inspiration Through Fermentation

Posting Permissions

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