Hi
I am working on a VB tool that uses an Access db. It was designed a while ago but at the moment needs some fixing. Basically I have the query below:
PARAMETERS NewUserID Long;
SELECT DISTINCT TOP 10 getField18.EntityID, getField18.EntityName, getField18.DateValue
FROM getField18 INNER JOIN getField19 ON getField18.EntityID = getField19.EntityID
ORDER BY getField18.DateValue DESC;
This is called from the VB code using the ADODB.COMMAND object which takes the statement to execute and 2 parameters. The above query is called.
What I need to do is check the second parameter and make a decision based on that i.e. i need something like the following:
PARAMETERS NewUserID Long, NewEntityType Text ( 1 );
SELECT DISTINCT TOP 10 getField18.EntityID, getField18.EntityName, getField18.DateValue
FROM getField18 INNER JOIN getField19 ON getField18.EntityID = getField19.EntityID
IF NewEntityType = 'V'
Begin
ORDER BY getField18.DateValue DESC
End
ELSE
Begin
ORDER BY getField18.DataValue ASC
End;
I have no idea if this would work, any help would be greatly appreciated.
I am working on a VB tool that uses an Access db. It was designed a while ago but at the moment needs some fixing. Basically I have the query below:
PARAMETERS NewUserID Long;
SELECT DISTINCT TOP 10 getField18.EntityID, getField18.EntityName, getField18.DateValue
FROM getField18 INNER JOIN getField19 ON getField18.EntityID = getField19.EntityID
ORDER BY getField18.DateValue DESC;
This is called from the VB code using the ADODB.COMMAND object which takes the statement to execute and 2 parameters. The above query is called.
What I need to do is check the second parameter and make a decision based on that i.e. i need something like the following:
PARAMETERS NewUserID Long, NewEntityType Text ( 1 );
SELECT DISTINCT TOP 10 getField18.EntityID, getField18.EntityName, getField18.DateValue
FROM getField18 INNER JOIN getField19 ON getField18.EntityID = getField19.EntityID
IF NewEntityType = 'V'
Begin
ORDER BY getField18.DateValue DESC
End
ELSE
Begin
ORDER BY getField18.DataValue ASC
End;
I have no idea if this would work, any help would be greatly appreciated.