Runtime Error '2001' (1 Viewer)

helper11

Registered User.
Local time
Today, 17:55
Joined
Apr 10, 2010
Messages
40
Help... I am losing my mind.

I have the following snipet of code, that when it tries to run get the error above, but if I use this off of my purchase date it works with no problem, any ideas would be a big help, both the purchase_date and refund_date are in the same query.

Dim StrR As String

If Not IsNull(Me.Combo3) Then

strR = "MonthName(Month(refund_date))= '" & Me.Combo3 & "'"

Me.Refunds.Form.Filter = strR
Me.Refunds.Form.FilterOn = True
End If
 

missinglinq

AWF VIP
Local time
Today, 17:55
Joined
Jun 20, 2003
Messages
6,420
This really makes no sense to me. You're saying

"MonthName(Month(refund_date))= '" & Me.Combo3 & "'"

The first part

MonthName(Month(refund_date))

is giving you the name of the month for the refund_date. You're then trying to create a string that says that this month's name is equal to the value of a combobox?
 

helper11

Registered User.
Local time
Today, 17:55
Joined
Apr 10, 2010
Messages
40
It is then using that value to filter a sub form and this is the value that is passed to that filter.

I actually found the problem, it was having a problem getting the month correctly, do not know why as it worked on 3 other forms using the same code, this one it did not want to work, so I changed it to send it the number of the month and that worked.

Thanks for your time...

This really makes no sense to me. You're saying



The first part

MonthName(Month(refund_date))

is giving you the name of the month for the refund_date. You're then trying to create a string that says that this month's name is equal to the value of a combobox?
 

Users who are viewing this thread

Top Bottom