D
Daniel W. Muill
I get a run-time error: 13 - Type Mistmatch error in the
following code:
Private Sub Taxable_Exit(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Dim ReceiptNum As Long
Dim TempReceipt As String
Set db = CurrentDb
Set rs = db.OpenRecordset("ReceiptNumber",
DB_OPEN_DYNASET)
If IsNull(DonorReceiptNumber) Then
GoTo AA
Else
GoTo ZZ
End If
AA:
If Taxable = "Y" Then
rs.MoveFirst
'rs.Edit
ReceiptNum = Val(rs![TaxableReceiptNumber])
TempReceipt = "R " + Mid(rs![TaxableReceiptNumber],
2, 6)
ReceiptNum = ReceiptNum + 1
rs![TaxableReceiptNumber] = Str(ReceiptNum)
rs.Update
GoTo BB
Else
rs.MoveFirst
'rs.Edit
ReceiptNum = Val(rs![NonTaxableReceiptNumber])
TempReceipt = "N " + Mid(rs![TaxableReceiptNumber],
2, 6)
ReceiptNum = ReceiptNum + 1
rs![NonTaxableReceiptNumber] = Str(ReceiptNum)
rs.Update
GoTo BB
End If
BB:
ZZ:
End Sub
The error comes on the Set rs= line
This code was copied from an older application copied
from Access 97. I think this problem has something to do
with references but I have checked my references and they
are as follows:
Visual Basic for Applications
Microsoft Access 10.0 Object Library
OLE Automation
Microsoft ActiveX Data objects 2.1 Library
Microsoft DAO 3.6 Object Library
I believe I need an additional reference but I am not
sure which one.
following code:
Private Sub Taxable_Exit(Cancel As Integer)
Dim db As Database
Dim rs As Recordset
Dim ReceiptNum As Long
Dim TempReceipt As String
Set db = CurrentDb
Set rs = db.OpenRecordset("ReceiptNumber",
DB_OPEN_DYNASET)
If IsNull(DonorReceiptNumber) Then
GoTo AA
Else
GoTo ZZ
End If
AA:
If Taxable = "Y" Then
rs.MoveFirst
'rs.Edit
ReceiptNum = Val(rs![TaxableReceiptNumber])
TempReceipt = "R " + Mid(rs![TaxableReceiptNumber],
2, 6)
ReceiptNum = ReceiptNum + 1
rs![TaxableReceiptNumber] = Str(ReceiptNum)
rs.Update
GoTo BB
Else
rs.MoveFirst
'rs.Edit
ReceiptNum = Val(rs![NonTaxableReceiptNumber])
TempReceipt = "N " + Mid(rs![TaxableReceiptNumber],
2, 6)
ReceiptNum = ReceiptNum + 1
rs![NonTaxableReceiptNumber] = Str(ReceiptNum)
rs.Update
GoTo BB
End If
BB:
ZZ:
End Sub
The error comes on the Set rs= line
This code was copied from an older application copied
from Access 97. I think this problem has something to do
with references but I have checked my references and they
are as follows:
Visual Basic for Applications
Microsoft Access 10.0 Object Library
OLE Automation
Microsoft ActiveX Data objects 2.1 Library
Microsoft DAO 3.6 Object Library
I believe I need an additional reference but I am not
sure which one.