I want to write a function that will check for the reporting date in a table. Where tblname is the table name and repfield is the field in tblname that contains the reporting date. I cant get it to work .
Can anyone help.
Much apprciated
Function sTableReportingDate(tblname As String, Repfield As Field)
Dim rs, rs1 As Recordset
Dim sSql, repdate As String
Dim db As Database
Set db = CurrentDb
sSql = sSql & ""
sSql = sSql & " SELECT DISTINCT [" & tblname & "].[" & Repfield & "]"
sSql = sSql & " FROM [" & tblname & "];"
Set rs = db.OpenRecordset(sSql)
repdate = rs.Fields(0)
sTableReportingDate = repdate
End Function
Can anyone help.
Much apprciated
Function sTableReportingDate(tblname As String, Repfield As Field)
Dim rs, rs1 As Recordset
Dim sSql, repdate As String
Dim db As Database
Set db = CurrentDb
sSql = sSql & ""
sSql = sSql & " SELECT DISTINCT [" & tblname & "].[" & Repfield & "]"
sSql = sSql & " FROM [" & tblname & "];"
Set rs = db.OpenRecordset(sSql)
repdate = rs.Fields(0)
sTableReportingDate = repdate
End Function