I am running Access 2003 and have created the following:
I modeled if after a successful one I have running in another database but this one gives me an "overflow" error and I can't figure out what that means or why I am getting the error. Can someone help me out?
Code:
Sub MSDeficient()
Dim HoldMSComplID As Integer
Dim HoldMNumber As Integer
Dim HoldMName As String
Dim HoldCourseID As Integer
Dim HoldDeficient As Integer
Dim dbObject As DAO.Database
Dim MSDeficiencyRS As DAO.Recordset
Dim EmpInfoRS As DAO.Recordset
Dim strQuery As String
Dim strquery1 As String
HoldMSComplID = Forms!frmMSCompl.Controls!TxtIDNumber.Value
HoldCourseID = Forms!frmMSCompl.Controls!MSCourse.Value
Set dbObject = CurrentDb
strquery1 = "SELECT * FROM MSDeficient "
strQuery = "SELECT * FROM EmpInfo "
Set MSDeficiencyRS = dbObject.OpenRecordset(strquery1)
Set EmpInfoRS = dbObject.OpenRecordset(strQuery)
With TMInfoRS
.MoveFirst
Do While Not .EOF
If .Fields("MSDeficient").Value = 0 Then
.MoveNext
Else
If .Fields("MSDeficient").Value = -1 Then
HoldTMNumber = .Fields("MNumber").Value
HoldTMName = .Fields("MName").Value
HoldDeficient = .Fields("MSDeficient").Value
End If
If .Fields("MSDeficient").Value = -1 Then
With MSDeficiencyRS
.AddNew
.Fields("MSCompID").Value = HoldMSComplID
.Fields("MNumber").Value = HoldTMNumber
.Fields("MName").Value = HoldTMName
.Fields("MSCourseID").Value = HoldCourseID
.Fields("MSDeficient").Value = HoldDeficient
.Update
End With
End If
End If
.MoveNext
Loop
End With
EmpInfoRS.Close
End Sub
I modeled if after a successful one I have running in another database but this one gives me an "overflow" error and I can't figure out what that means or why I am getting the error. Can someone help me out?