Hi There,
Yes, still a newbie AND trying to change somebody else work. I am working with Access 2003. I have a new record button on a form and I can get it to add a new record but I can't get it to display. However, if I close the form and re-open it there is the new record, what am I doing wrong? Here is the code (part mine part somebody else):
Yes, still a newbie AND trying to change somebody else work. I am working with Access 2003. I have a new record button on a form and I can get it to add a new record but I can't get it to display. However, if I close the form and re-open it there is the new record, what am I doing wrong? Here is the code (part mine part somebody else):
Code:
Private Sub cboAddRecord_Click()
On Error GoTo Error_Handler
Dim db As Database
Set db = CurrentDb
Dim rs As DAO.Recordset
Dim lngDlyRptID As Long
Set rs = db.OpenRecordset("tblDailyReport", dbOpenDynaset)
With rs
.AddNew
!txtName = Me.Name
!txtInit = Me.txtInit
!txtInstructor = Me.txtInstructor
!datReportDate = Me.datReportDate
!TrainingCode = Me.TrainingCode
!TrainingDay = Nz(Me.TrainingDay, 0) + 1
!TrainingDayOfCycle = Nz(Me.TrainingDayOfCycle, 0) + 1
!TrainingCycle = Me.TrainingCycle
!TrainingPhase = Me.TrainingPhase
.Update
rs.Bookmark = rs.LastModified
'DRID = Daily Report ID - Primary Key
lngDlyRptID = Me.DRID
Set rs = Me.RecordsetClone
'DRID = Daily Report ID - Primary Key
rs.FindFirst "DRID = " & lngDlyRptID
If Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
rs.Close
Set rs = Nothing
End With
Exit_Procedure:
Exit Sub
Error_Handler:
MsgBox "An error has occurred in this application. " _
& "Please contact your technical support person and " _
& "tell them this information:" _
& vbCrLf & vbCrLf & "Error Number " & Err.Number & ", " _
& Err.Description, _
Buttons:=vbCritical, Title:="UQS Unit Qualification Software V.111"
Resume Exit_Procedure