Query on a DataRecordSet with GetRowIDs

Started by lindir, February 26, 2015, 01:24:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lindir

Hello guys!!

I have som trouble to figured out how to use this properties:
https://msdn.microsoft.com/en-us/library/office/ff768503.aspx

I have a data record a column with Data for instance and i want to find the row with a specific data.
Like for example I want to know which row of my data recordset contain the following date 09/02/2015;
I don't know how to parametre the CriteriaString to do this research.
Msdn says:
CriteriaString =A string that conforms to the guidelines specified in the Microsoft ActiveX Data Object (ADO) API for setting the ADO.Filter property

That's some chinese to me, I tried to google it but didn't find anything, I also tried to put some SQL in this  CriteriaString  and it doesn't work: either SQL is not appropriate or I don't use the right typologie for SQL and VBA.

Thanks for your valuable help and time!

Cheers!!



lindir

I partially find the solutin
You don't have to put some SQL is it even more simple:
CriteriaString = "[Date]='' "
It will give me the ID of the row which have no date, but the problem is that my datarecordset is connected to a microsoft SQL server database.
So I know the date but I don't know the hours and minute etc....

My data recordset have for instance 09/01/2015 19:35
And I just want to get the row ids of all the record with 09/01/2015
So when I do CriteriaString = "[Date]=09/01/2015" it doesn't fin anything...
Any idea??

Yacine

Hi Lindir,
you're close to the solution. It's only a matter of correct syntax.
If you do have MS-Access available (or any other DBMS) create a query similar to the one you need (eg Date=...), then look at the so generate SQL commands and use the same syntax in your code.

HTH,
Y.
Yacine

lindir

OK yes it works to have the good synthax.

Merci Yacine!