Hi
I have created a form (not attached to a table) into which I get the user to enter some details. I then open a new record in the required table and write in the details. As follows-
' Adds a new record to a Recordset using the data on the new form
With rstAddAction
.AddNew
!ActionNumber = Me.ActionNumber
!ActionType = Me.ActionType
!StdClauseID = Me.StdClauseID
!NonConf = Me.NonConf
!RootCause = Me.RootCause
!Action = Me.Action
!Progress = Me.Progress
!AuditID = Me.AuditID
!LaboratoryID = Me.LaboratoryID
!BusinessManID = Me.BusinessManID
!RespPerson = Me.RespPerson
!RaisedDate = Me.RaisedDate
!ToQualityDate = Me.ToQualityDate
!ToBMDate = Me.ToBMDate
!FromBMDate = Me.FromBMDate
!ActTargetDate = Me.ActTargetDate
!ActCompDate = Me.ActCompDate
!FollowUP = Me.FollowUP
!QMSignOff = Me.QMClose
!FollowUp2 = Me.FollowUp2
.Update
End With
' Clean up recordsets
rstAddAction.Close
Set rstAddAction = Nothing
Set db = Nothing
I note when examining the running of this code using debug the record is not written directly to the table and at this stage of the code there is no new record in the table. The record only seems to appear once the Sub closes.
What I wanted to do is to open the newly saved record while still in the same Sub, with another form so that further data can be input but the record is not there to open.
How do I force the record to be written to the table when I do the .update command so at it appears in the table and I can then use it in another form.
Thanks for any help.
I have created a form (not attached to a table) into which I get the user to enter some details. I then open a new record in the required table and write in the details. As follows-
' Adds a new record to a Recordset using the data on the new form
With rstAddAction
.AddNew
!ActionNumber = Me.ActionNumber
!ActionType = Me.ActionType
!StdClauseID = Me.StdClauseID
!NonConf = Me.NonConf
!RootCause = Me.RootCause
!Action = Me.Action
!Progress = Me.Progress
!AuditID = Me.AuditID
!LaboratoryID = Me.LaboratoryID
!BusinessManID = Me.BusinessManID
!RespPerson = Me.RespPerson
!RaisedDate = Me.RaisedDate
!ToQualityDate = Me.ToQualityDate
!ToBMDate = Me.ToBMDate
!FromBMDate = Me.FromBMDate
!ActTargetDate = Me.ActTargetDate
!ActCompDate = Me.ActCompDate
!FollowUP = Me.FollowUP
!QMSignOff = Me.QMClose
!FollowUp2 = Me.FollowUp2
.Update
End With
' Clean up recordsets
rstAddAction.Close
Set rstAddAction = Nothing
Set db = Nothing
I note when examining the running of this code using debug the record is not written directly to the table and at this stage of the code there is no new record in the table. The record only seems to appear once the Sub closes.
What I wanted to do is to open the newly saved record while still in the same Sub, with another form so that further data can be input but the record is not there to open.
How do I force the record to be written to the table when I do the .update command so at it appears in the table and I can then use it in another form.
Thanks for any help.