Skip to content
Advertisement

Having trouble with IF condition using SQL

I cannot seem to get this IF statement to step into the Call Expiry part it goes to the else therefore I can only assume there is something wrong with my condition.

I’m trying to fetch the contract status from an access table Investment Data WHERE Customer Number is the Customer Number on the current spreadsheet. (There is only 1 customer number on spreadsheet).

Is there something wrong with my logic or does the SELECT statement return something that is not a string?

Any Help is appreciated, thanks.

Edit 1: In terms of trying to store the SELECT I have the following

I know the the return value of a Recordset is not a String I just don’t know how I would store it in a variable.

Advertisement

Answer

You will need to put the value into something so as you can compare it in the if statement. If I understand what you want then give this a try. I am also assuming you will get one result in the SQL statement.

I also have not amended your code inside the if statement to follow my way I accessing the database.

To answer your question in the coments. The result will be transposed into the variable. so accessing more than one row or column , you will need to do something like this.

For getting the rows,

For getting the columns,

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement