G
Guest
Hello
i have a recordset i would like to filter
This recordset is from a table where a field named "codcommessa" has value like "1-dg-2003", "2-dg-2003" and so on.
to assign a new code i need to know which is the higher digits on the right of the previous code, keeping in count also the year to which the code reffers (last 4 digits)
So, first of all i would filter the recordset to have only records for a certain year (the one we are when code runs)
i have builded several string expression for the .filter proprierties of the recordset and nothing works.... there's something wrong with how i create this string... can someone check it
here is the code
Dim data As Strin
data = Format(Date, "yyyy"
Dim rst As ADODB.Recordse
Set rst = New ADODB.Recordse
rst.Open "tblcommesse", CurrentProject.Connection, adOpenStatic, adLockOptimisti
With rs
.Filter = "Right(.Fields(""codcommessa"").Value, 4)='" & data & "'
on the last line code stops for bug
thanks in advance
Rocco
i have a recordset i would like to filter
This recordset is from a table where a field named "codcommessa" has value like "1-dg-2003", "2-dg-2003" and so on.
to assign a new code i need to know which is the higher digits on the right of the previous code, keeping in count also the year to which the code reffers (last 4 digits)
So, first of all i would filter the recordset to have only records for a certain year (the one we are when code runs)
i have builded several string expression for the .filter proprierties of the recordset and nothing works.... there's something wrong with how i create this string... can someone check it
here is the code
Dim data As Strin
data = Format(Date, "yyyy"
Dim rst As ADODB.Recordse
Set rst = New ADODB.Recordse
rst.Open "tblcommesse", CurrentProject.Connection, adOpenStatic, adLockOptimisti
With rs
.Filter = "Right(.Fields(""codcommessa"").Value, 4)='" & data & "'
on the last line code stops for bug
thanks in advance
Rocco