M
Mike
I just started playing around with recordsets and trying to move around the
datasheet to perform certain calculations. What I'm first trying to do is
just pull data from a field and enter it into a new field in the record
below, if I can figure out how to do this, I can do my calculations - each
record is an event:
Event1 / DateTime1 / NoCalc
Event2 / DateTime2 / DateTime2-DateTime1
Anyways, my baby step looks like this:
Function ChkLastRec()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim tblName As String
tblName = "TEST"
Set db = CurrentDb
Set rs = db.OpenRecordset(tblName)
If rs.BOF Then
ChkLastRec = 1
Else
ChkLastRec = 0
End If
End Function
I call this function from a MS Access query, but it gives me unknown error
28 on this line: Set rs = db.OpenRecordset(tblName)
So, I have two questions:
1. What am I doing wrong?
2. If its an unknown error... how come there's an error number??? LOL
datasheet to perform certain calculations. What I'm first trying to do is
just pull data from a field and enter it into a new field in the record
below, if I can figure out how to do this, I can do my calculations - each
record is an event:
Event1 / DateTime1 / NoCalc
Event2 / DateTime2 / DateTime2-DateTime1
Anyways, my baby step looks like this:
Function ChkLastRec()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim tblName As String
tblName = "TEST"
Set db = CurrentDb
Set rs = db.OpenRecordset(tblName)
If rs.BOF Then
ChkLastRec = 1
Else
ChkLastRec = 0
End If
End Function
I call this function from a MS Access query, but it gives me unknown error
28 on this line: Set rs = db.OpenRecordset(tblName)
So, I have two questions:
1. What am I doing wrong?
2. If its an unknown error... how come there's an error number??? LOL