1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access 2002 Variable If ... Then Condition

Discussion in 'Business Applications' started by chaddull, Jan 22, 2003.

Thread Status:
Not open for further replies.
  1. chaddull

    chaddull Thread Starter

    Jan 22, 2003
    I'm having trouble using a string variable as a condition in my If...Then statement. I have a concatenated variable which refers to an open recordset:

    strAddNewCriteria = "rstDeliverable!" & strActFieldName & " <> 0 And rstDeliverable!booRequired = True And " & strClassCriteria

    I try to execute an If...Then loop using strAddNewCriteria as the If criteria:

    If Eval(strAddNewCriteria) Then

    The application tells me that Access cannot find the rstDeliverable recordset. But, when I use the actual string (rather than the variable), the If...Then loop functions properly.

    Does anyone have any suggestions?

    Thank you very much.
  2. kbstoikop


    Dec 13, 2002
    i dont know if microsoft fixed this but in access97 it doesnt like to evaluate expresions using true or false rather use "-1" for true and "0" for false.
  3. AbvAvgUser


    Oct 3, 2002
    I am not entirely able to understand your problem here. Please clarify.

    Secondly, from whatever I saw in your post, I feel there should be some syntax errors generated in code because there are some open quotes to which there are no corresponding close quotes :(
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/114710

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice