Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2004
    Posts
    41

    Unanswered: How to have to two conditions?

    I have new in MS access. How can you have to conditions in order to jump to next forms? For one condition, I use stLinkCriteria. What about those that need two conditions? I try to "AND" using two stLinkCriteria but it does not works. Please help. Thanks

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Use
    If Then

    Else

    Endif

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You can have more than one criteria i a strLinkCriteria (although the open form wizard only allows you to pick one!). If it is not working then there is an error in the criteria definition string!?

    When you say it doesn't work, is not opening this the required record(s) or does it produce an error message?

    MTB

  4. #4
    Join Date
    Aug 2004
    Posts
    41

    Smile

    To make it more clear, I like to ask is that a simple way like using some default command to link two conditions to open a new form. I also think of "If else statement" but i think there might be a default command to link it. The problem is when i use two stlinkcriteria and try to "And" them together, it give out an error message. And when i put two conditions inside the stlinkcriteria using "and", it also give a error message. Thanks for taking time to help me.

  5. #5
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    I think you need to post you code that constructs the criteria so we can see what you are trying to do.

    MTB

  6. #6
    Join Date
    Aug 2004
    Posts
    41
    Hi there,
    The code is like this:
    stLinkCriteria = "[Site ID]=" & "'" & Me![Site ID] & "'"
    stLinkCriteria = "[Site Name]= " & " '" & Me![Site Name] & "'"

    Is there a way to have these two conditions as one?? I try to "And" them but it has a error message.

  7. #7
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Try

    stLinkCriteria = "[Site ID]=" & "'" & Me![Site ID] & "' AND [Site Name]= " & " '" & Me![Site Name] & "'"


    MTB

  8. #8
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi again

    One other thought, it Site ID is numeric then you should try this

    stLinkCriteria = "[Site ID]=" & Me![Site ID] & " AND [Site Name]= " & " '" & Me![Site Name] & "'"

    MTB

  9. #9
    Join Date
    Aug 2004
    Posts
    41
    It give an error message. "Type mismatch."

  10. #10
    Join Date
    Aug 2004
    Posts
    41
    Sorry...my mistake...It is working very well..Thanks a lot..

Posting Permissions

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