I have query like below and I can't add more conditions.
Set rst = CurrentDb.OpenRecordset("SELECT [Value1],[Value2] FROM Query1 where DATA_1 >= #" & Me.Tekst22.Value & "# and DATA_2 <= #" & Me.Tekst24.Value & "#", dbOpenSnapshot)
It works great but I need to add two more conditiones :
and ([Value3] = Me.Tekst34 or [Value4] = Me.Tekst34)
If I add code like this
Set rst = CurrentDb.OpenRecordset("SELECT [Value1],[Value2] FROM Query1 where DATA_1 >= #" & Me.Tekst22.Value & "# and DATA_2 <= #" & Me.Tekst24.Value & "# and ([Value3] = " & Me.Tekst34.Value & " or [Value4] = " & Me.Tekst34.Value & " ", dbOpenSnapshot)
I've got: Run-time error '3061'. Too few parameters. Expected 3
Please help me to correct this error.
additional: Next step after run this Query1 is print values to text file.
Open "c:\test.txt" For Output As #1
Set rst = CurrentDb.OpenRecordset("Query1")
Do While Not rst.EOF
Print #1, rst!VALUE1 & " " & rst!VALUE2
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Close #1
That is what I need. Run Query1 (now it's with all needed parametrs) and print two values to text file.