UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Docmd.applyfilter To SQL Linked Database Table, Access 2016    
 
   
marinko888
post Feb 14 2020, 01:14 PM
Post#1



Posts: 93
Joined: 9-April 19



Hi,
I am using this Filter for filtering data from a linked SQL database table:

DoCmd.ApplyFilter , "dbo_Session.[DatumStart] BETWEEN '" & Me.SessionStart & "' And '" & Me.SessionEnd & "'"

but I am getting an error:

Attached File  Capture.PNG ( 2.54K )Number of downloads: 0


TextBox Format is ShortDate and linked SQL Database Table Field Format is Date...

What is the problem here?

Thanks for your help!
Go to the top of the page
 
theDBguy
post Feb 14 2020, 01:19 PM
Post#2


UA Moderator
Posts: 77,715
Joined: 19-June 07
From: SunnySandyEggo


Hi. Just a guess, but unless it's a pass through query, the delimiter for dates in Access is the # character.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
marinko888
post Feb 14 2020, 01:26 PM
Post#3



Posts: 93
Joined: 9-April 19



It is the linked SQL Database Table so the delimiter is ' character...
Go to the top of the page
 
theDBguy
post Feb 14 2020, 01:35 PM
Post#4


UA Moderator
Posts: 77,715
Joined: 19-June 07
From: SunnySandyEggo


Hi. I understand that; but if you're executing the filter code in Access, then I think you'll have to use Access' language.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
marinko888
post Feb 14 2020, 01:40 PM
Post#5



Posts: 93
Joined: 9-April 19



I have already tried that without success.
Go to the top of the page
 
theDBguy
post Feb 14 2020, 02:33 PM
Post#6


UA Moderator
Posts: 77,715
Joined: 19-June 07
From: SunnySandyEggo


Hi. Sorry to hear that...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
cheekybuddha
post Feb 14 2020, 02:35 PM
Post#7


UtterAccess Moderator
Posts: 12,619
Joined: 6-December 03
From: Telegraph Hill


Hi,

Try either:
CODE
  DoCmd.ApplyFilter , "dbo_Session.[DatumStart] BETWEEN '" & Format(Me.SessionStart, "yyyy-mm-dd hh:nn:ss") & "' And '" & Format(Me.SessionEnd, "yyyy-mm-dd hh:nn:ss") & "'"

Or:
CODE
  DoCmd.ApplyFilter , "dbo_Session.[DatumStart] BETWEEN #" & Format(Me.SessionStart, "yyyy-mm-dd hh:nn:ss") & "# And #" & Format(Me.SessionEnd, "yyyy-mm-dd hh:nn:ss") & "#"


hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
marinko888
post Feb 14 2020, 05:28 PM
Post#8



Posts: 93
Joined: 9-April 19



Thanks for helping me out with this one. This is finally working out!
Go to the top of the page
 
cheekybuddha
post Feb 15 2020, 03:55 AM
Post#9


UtterAccess Moderator
Posts: 12,619
Joined: 6-December 03
From: Telegraph Hill


Hi, please share your working solution if you get the chance.

--------------------


Regards,

David Marten
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    31st March 2020 - 02:27 AM