G
Guest
I am a new access user migrating from Approach. I discovered this code in a
previous posting by Van T. Dinh...
I have a form based on a table=newhire, I have another table = required,
both have a field named "rec_" there are 6 fields of data that I want to
auto fill for the user on the afterupdate event of the "rec_" field on my
form if a rec_ exists.
the code errors at....
Set rc = Qr.OpenRecordset(dbOpenDynaset)
The error is 'runtime error '424' : Object required...
Any guidance would be greatly appreciated. Below is the entire code...
Private Sub REC__AfterUpdate()
Dim strSql As String
Dim rc As DAO.Recordset
If IsNull(Me.REC_) Then
Me.JOB_NAME = Null
Me.DICIPLINE = Null
Me.ST = Null
Me.OT = Null
Me.PD = Null
Me.BONUS_TRAV = Null
Else
strSql = "SELECT required.job_name, required.disc, required.st,
required.ot, required.pd, required.bonustrave, FROM Required WHERE rec_ =
Me.rec_ & """""
Set rc = Qr.OpenRecordset(dbOpenDynaset)
If rc.RecordCount > 0 Then
Me.JOB_NAME = rc!JOB_NAME
Me.ST = rc!ST
Me.OT = rc!OT
Me.PD = rc!PD
Me.BONUS_TRAV = rc!BONUS_TRAVE
End If
rc.Close
End If
Set rc = Nothing
End Sub
Thanks
Brian
previous posting by Van T. Dinh...
I have a form based on a table=newhire, I have another table = required,
both have a field named "rec_" there are 6 fields of data that I want to
auto fill for the user on the afterupdate event of the "rec_" field on my
form if a rec_ exists.
the code errors at....
Set rc = Qr.OpenRecordset(dbOpenDynaset)
The error is 'runtime error '424' : Object required...
Any guidance would be greatly appreciated. Below is the entire code...
Private Sub REC__AfterUpdate()
Dim strSql As String
Dim rc As DAO.Recordset
If IsNull(Me.REC_) Then
Me.JOB_NAME = Null
Me.DICIPLINE = Null
Me.ST = Null
Me.OT = Null
Me.PD = Null
Me.BONUS_TRAV = Null
Else
strSql = "SELECT required.job_name, required.disc, required.st,
required.ot, required.pd, required.bonustrave, FROM Required WHERE rec_ =
Me.rec_ & """""
Set rc = Qr.OpenRecordset(dbOpenDynaset)
If rc.RecordCount > 0 Then
Me.JOB_NAME = rc!JOB_NAME
Me.ST = rc!ST
Me.OT = rc!OT
Me.PD = rc!PD
Me.BONUS_TRAV = rc!BONUS_TRAVE
End If
rc.Close
End If
Set rc = Nothing
End Sub
Thanks
Brian