vba and filter issue

swarv

Registered User.
Local time
Today, 13:13
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: 107
The delimiter for dates is the octothorp (#), not a quote.
datestr = "createddate > #" & d & "#"
 

Users who are viewing this thread

Back
Top Bottom