Access 2002 Variable If ... Then Condition

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

chaddull

Thread Starter
Joined
Jan 22, 2003
Messages
1
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.
 
Joined
Dec 13, 2002
Messages
45
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.
 
Joined
Oct 3, 2002
Messages
2,281
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 :(
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top