mcdhappy80
Registered User.
- Local time
- Today, 02:19
- Joined
- Jun 22, 2009
- Messages
- 347
I'm trying to make the data in form filter by [dteMesec] field which holds date which is one month less than today date.
Here's the forms onLoad code:
I'm getting "3075 - Syntax error in date in query expression '[dteMesec]=#1.11.2009' ".
What is wrong here?
Thank You
==================================
I've solved the problem. I'll post later how
Here's the forms onLoad code:
Code:
Private Sub Form_Load()
Dim rs2 As DAO.Recordset
Dim dteMesecManje As Variant
Dim dteDan As Variant
Dim dteGodina As Variant
On Error GoTo Obrada_Greske
Set rs2 = CurrentDb.OpenRecordset("tblZaduzivanje")
If rs2.RecordCount = 0 Then
'MsgBox "Nema zaduzivanja"
' I FILTER SE NE PRIMENJUJE I TO JE OK
Else
'*** SMANJIVANJE ZA MESEC UNAZAD ***
dteMesecManje = Format(DateAdd("m", -1, Date), "mmmm")
dteDan = Format(Date, "dd")
dteGodina = Format(Date, "yyyy")
dteMesecManje = CDate(dteDan & "/" & dteMesecManje & "/" & dteGodina)
Me.Filter = "[dteMesec] = #" & dteMesecManje & "#"
Me.FilterOn = True
DoCmd.Requery
End If
rs2.Close
Set rs2 = Nothing
Izadji_Ovde:
Exit Sub
Obrada_Greske:
MsgBox Err.Number & " - " & Err.Description, vbInformation, "Greska je!"
Resume Izadji_Ovde
End Sub
What is wrong here?
Thank You
==================================
I've solved the problem. I'll post later how
Last edited: