L
LyonA
Guest
I am currently havinbg a problem with a function within an Access 95 module.
The problem code looks like this:
1> Function AddNewResponse()
2>
3>
4> On Error GoTo AddError
5>
6> Dim db As DATABASE
7> Dim rs As Recordset
8>
9> Set db = CurrentDb()
10> Set rs = db.OpenRecordset("Response", DB_OPEN_TABLE)
11>
12> rs.AddNew ' Add the new record
13>
14> rs!Name = Forms![update incident]!RName
15> rs!Date = Forms![update incident]!RDate
16> rs!Time = Forms![update incident]!RTime
17> rs!Response = Forms![update incident]!RDesc
18> rs![Incident Number] = Forms![update incident]![Incident Number]
19> rs![Series Identity] = Forms![update incident]![Series Identity]
20>
21> rs.UPDATE
22> rs.Close
23>
24> Exit Function
25>AddError:
The problem is that line 6 is not working as it should be creating db as a DAO database object, instead it appears to be creating a VBA DATABASE statement.
This line is in one version of the database which works fine (this database is a standalone database), however, in the current multi-user database the function does not work. I have checked that the references are pointing to the same things and they are, but the problem still occurs in the newer db.
If there is anyone who is able to help please email me
The problem code looks like this:
1> Function AddNewResponse()
2>
3>
4> On Error GoTo AddError
5>
6> Dim db As DATABASE
7> Dim rs As Recordset
8>
9> Set db = CurrentDb()
10> Set rs = db.OpenRecordset("Response", DB_OPEN_TABLE)
11>
12> rs.AddNew ' Add the new record
13>
14> rs!Name = Forms![update incident]!RName
15> rs!Date = Forms![update incident]!RDate
16> rs!Time = Forms![update incident]!RTime
17> rs!Response = Forms![update incident]!RDesc
18> rs![Incident Number] = Forms![update incident]![Incident Number]
19> rs![Series Identity] = Forms![update incident]![Series Identity]
20>
21> rs.UPDATE
22> rs.Close
23>
24> Exit Function
25>AddError:
The problem is that line 6 is not working as it should be creating db as a DAO database object, instead it appears to be creating a VBA DATABASE statement.
This line is in one version of the database which works fine (this database is a standalone database), however, in the current multi-user database the function does not work. I have checked that the references are pointing to the same things and they are, but the problem still occurs in the newer db.
If there is anyone who is able to help please email me