Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

Is there a better way in dao to add a record in the recordset ?

ACCESS 2010  VBA


The Linked table "trans_time_entry" has quite a few records in it.

Is there a better way in dao to add a record in the recordset ?

Dim R As DAO.Recordset

If Me.Combo26.Text = "Closed" Then
             Set R = CurrentDb.OpenRecordset("SELECT * FROM [trans_time_entry]", dbOpenDynaset, dbSeeChanges)
                 R.AddNew
                 R![NSC_ID_Ref] = Me.NSC_Id
             Forms!nsc_dataentry.txtReOpened.SetFocus
             
             If Forms!nsc_dataentry.txtReOpened.Text = "" Then
                R![opened_at] = date_Now 'Forms!NSC_DataEntry.txtReOpened
             Else
                R![opened_at] = Forms!nsc_dataentry.txtReOpened 'd
             End If
                          
                R![InProgress_or_Closed_at] = date_Now
                R.Update
                R.Close
                Set R = Nothing
                Rvs = False

Open in new window


Thanks
fordraiders
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fordraiders

ASKER

Thanks all !!
Since four people offered four DIFFERENT suggestions, did you use ANY of them?  Accepting all answers is as bad as abandoning the question since the point of the closure is not to give participation points to everyone who offered an opinion but to reward the person who ACTUALLY provided the answer and to guide people who find the question later using a web search.   You have left everyone in the dark and diminished the value of the work of the person who did provide the answer.  Sometimes it takes a village and in that case it makes sense to choose more than one answer.  Sometimes none of the answers led to a solution.  In that case, accept one of your own answers for no points and write a comment giving folks the solution that did work or the information that you were not able to solve the problem.

There is a reason why utopias don't work.  They sound good on paper.  They are all warm and fuzzy but if everyone gets the same reward whether they contribute or not, eventually nobody does anything.  Who wants to clean up the garbage when there are better jobs to be done or you don't even have to work at all.   Accepting one answer over others does not offend the experts.  They all know that sometimes another answer will be more suitable.