lookforsmt
Registered User.
- Local time
- Today, 11:14
- Joined
- Dec 26, 2011
- Messages
- 672
HI! I have below table where i need to get a auto-number based on date, each time a new date is identified the counter reset starts from 1 onwards in field IDNos
I also have a field SrNo which has PK with Data-type as auto-numbering.
i have found the below code and tried to work with below table. Any help on what i am doing wrong.
Code found on the internet
In the query i have placed the below expression but i am getting below result
Result in Query1
i I will be using the query1 linked to a subform for data entry
Any help pls., Thanks
I also have a field SrNo which has PK with Data-type as auto-numbering.
i have found the below code and tried to work with below table. Any help on what i am doing wrong.
Code:
Table Name: Table3
---------------------------------------------------------------
SrNo EntryDate OurRef IDNos
1 20/08/2019 OCC026200810 1
2 20/08/2019 OCC026200810 2
3 20/08/2019 OCC026200810 3
4 21/08/2019 OCC026210810 1
5 21/08/2019 OCC026210810 2
7 22/08/2019 OCC026220810 1
9 24/08/2019 OCC026240810 1
Code found on the internet
Code:
Public Function RowNumber(OurRef As String, _
EntryDate As Date, _
qry As String) As Long
Dim rst As DAO.Recordset
Dim lngVA As Long
On Error Resume Next
Set rst = CurrentDb.OpenRecordset(qry, dbOpenDynaset)
With rst
.FindFirst "[" & OurRef & "] = #" & EntryDate & "#"
lngVA = .AbsolutePosition + 1
End With
RowNumber = lngVA
End Function
In the query i have placed the below expression but i am getting below result
Code:
IDNos: RowNumber("SrNo",[SrNo],"Query1")
Result in Query1
Code:
IDNos
---------
1
2
1
1
1
1
1
Any help pls., Thanks