Hello, I'm new in these forums but and i'm fairly new at MS Access programming since I utilize java most of the time.
I'm currently using Access 2003 and was wondering why I encounter an error with my Code.
The Code is Below
Private Sub cmdSave_Click()
' Dim thisText As String
' thisText = DMax("ASRNUM", "ASR")
' MsgBox thisText
Dim db As DAO.Database, checkASR As DAO.Recordset, checkEntry As DAO.Recordset
Set db = CurrentDb
If MsgBox("Save records now?", vbYesNo, "Save ASR") = vbYes Then
Set checkASR = db.OpenRecordset("SELECT DateCoveredFrom,DateCoveredTo FROM ASR WHERE EmpID = " & TxtEmpID.Text)
checkASR.Requery
checkASR.MoveFirst
Do While Not checkASR.EOF
MsgBox checkASR("DateCoveredFrom")
checkASR.MoveNext
Loop
checkASR.MoveFirst
End If
End Sub
Error 2158 states that checkASR object does not have focus. Any idea how I can go around this?
Much thanks for the help since I'm really crawling in the dark.
I'm currently using Access 2003 and was wondering why I encounter an error with my Code.
The Code is Below
Private Sub cmdSave_Click()
' Dim thisText As String
' thisText = DMax("ASRNUM", "ASR")
' MsgBox thisText
Dim db As DAO.Database, checkASR As DAO.Recordset, checkEntry As DAO.Recordset
Set db = CurrentDb
If MsgBox("Save records now?", vbYesNo, "Save ASR") = vbYes Then
Set checkASR = db.OpenRecordset("SELECT DateCoveredFrom,DateCoveredTo FROM ASR WHERE EmpID = " & TxtEmpID.Text)
checkASR.Requery
checkASR.MoveFirst
Do While Not checkASR.EOF
MsgBox checkASR("DateCoveredFrom")
checkASR.MoveNext
Loop
checkASR.MoveFirst
End If
End Sub
Error 2158 states that checkASR object does not have focus. Any idea how I can go around this?
Much thanks for the help since I'm really crawling in the dark.
Last edited: