mfaqueiroz
New Member
- Joined
- Sep 30, 2015
- Messages
- 5
Hello
I'm creating one query on VBA with the following filters:
1.Date<Date1 of my query QA
2.Miliseconds < Milseconds of my query QA
3.State = State1 | | | | |
4.Tag=Tag1
I've write the following:
Set dbs = DBEngine(0)(0)
Set QA = dbs.OpenRecordset("A", DB_OPEN_DYNASET)
Data1 = CDate(QA.Fields(2).Value
ms1 = QA.A(3).Value
state1 = QA.Fields(7).Value
tag1 = QA.Fields(8).Value
Set Tb_Test = dbs.OpenRecordset("SELECT TabInst.[ID], TabInst.[date], TabInst.[ms], TabInst.[Instalação], TabInst.[Painel], TabInst.[Descrição], TabInst.[State], TabInst.[Tag], TabInst.[Visto] FROM TabInst WHERE [date] < #" & Data1 & "# And [ ms] < " & ms1 & " And [State] = '" & State1 & "' And [Tag] = '" & Tag1 & "' ORDER BY TabInst.[date], TabInst.[ ms];", DB_OPEN_DYNASET)
This isn't working, my question is:
-I'm comparing the dates and the ms in the right way?
-The date format is dd-mm-aaaa hh:mm:ss
-The ms are only numbers...i should put the "&?
-The state and Tag are text , I assume that the comparison is write the correct way...
Thank in advance for your help
I'm creating one query on VBA with the following filters:
1.Date<Date1 of my query QA
2.Miliseconds < Milseconds of my query QA
3.State = State1 | | | | |
4.Tag=Tag1
I've write the following:
Set dbs = DBEngine(0)(0)
Set QA = dbs.OpenRecordset("A", DB_OPEN_DYNASET)
Data1 = CDate(QA.Fields(2).Value
ms1 = QA.A(3).Value
state1 = QA.Fields(7).Value
tag1 = QA.Fields(8).Value
Set Tb_Test = dbs.OpenRecordset("SELECT TabInst.[ID], TabInst.[date], TabInst.[ms], TabInst.[Instalação], TabInst.[Painel], TabInst.[Descrição], TabInst.[State], TabInst.[Tag], TabInst.[Visto] FROM TabInst WHERE [date] < #" & Data1 & "# And [ ms] < " & ms1 & " And [State] = '" & State1 & "' And [Tag] = '" & Tag1 & "' ORDER BY TabInst.[date], TabInst.[ ms];", DB_OPEN_DYNASET)
This isn't working, my question is:
-I'm comparing the dates and the ms in the right way?
-The date format is dd-mm-aaaa hh:mm:ss
-The ms are only numbers...i should put the "&?
-The state and Tag are text , I assume that the comparison is write the correct way...
Thank in advance for your help