vba and filter issue (1 Viewer)

swarv

Registered User.
Local time
Today, 12:56
Joined
Dec 2, 2008
Messages
196
Hi all,

Is there any reason why this doesn't work?

Code:
Private Sub Report_Load()
Dim s As String
Dim d As String
Dim str As String
Dim datestr As String
s = InputBox("Enter the dept", "Inventory")
d = InputBox("Enter the date from", "Inventory")
str = "dept = '" & s & "'"
datestr = "createddate > '" & d & "'"
DoCmd.ApplyFilter , str & ";" & datestr
End Sub

It asks me 3 times for the info, twice for the s value and once for the d value.
Then the datestr doesn't work.

It was working fine till I put in the datestr feature bit.

Many thanks

Martin
 

Attachments

  • Untitled1.jpg
    Untitled1.jpg
    60.4 KB · Views: 75

RuralGuy

AWF VIP
Local time
Today, 05:56
Joined
Jul 2, 2005
Messages
13,825
The delimiter for dates is the octothorp (#), not a quote.
datestr = "createddate > #" & d & "#"
 

Users who are viewing this thread

Top Bottom