Updating recodset from mulitple list boxes and text boxes

Private Sub Command27_Click()
     Dim db As DAO.Database
     Dim rs As DAO.Recordset
     
     Set db = CurrentDb
     Set rs = db.OpenRecordset("tbl_StaffEval", dbOpenTable)
     
     rs.AddNew
     rs.Fields("ProviderID") = Me.List33.Column(0)
     If Len(Me.List33.Column(2)) > 0 Then
         rs.Fields("SpecialtyID") = Me.List33.Column(2)
         rs.Fields("Specialty") = Me.List33.Column(3)
     Else
         rs.Fields("SpecialtyID") = Me.lstSpec.Column(0)
         rs.Fields("Specialty") = Me.lstSpec.Column(1)
     End If
     
     rs.Fields("RptDate") = Me.txtRptDt
     rs.Fields("RptPeriod") = Me.txtRptPD
     rs.Fields("ReviewBeg") = Me.txtRptBeg
     rs.Fields("ReviewEnd") = Me.txtEnd
     rs.Fields("TypeID") = Me.LstEval.Column(0)
     rs.Fields("Type") = "ACTIVE"
     
     
     
     
     
     rs.Update
     
     rs.Close
     
     Set rs = Nothing
     
 End Sub

From my previous question, I was given direction on updating a recordset from one column in a Listbox.

Now I am trying to add a record in a table with multiple fields from different objects on a form.

The above code has no effect on the target table.

Thanks

Glen
GPSPOWAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupCommented:
Try this:

Private Sub Command27_Click()
     Dim db As DAO.Database
     Dim rs As DAO.Recordset
     
     Set db = CurrentDb
     Set rs = db.OpenRecordset("tbl_StaffEval", dbOpenDynaset)
     
     rs.AddNew
     rs.Fields("ProviderID") = Me.List33.Column(0)
     If Len(Me.List33.Column(2)) > 0 Then
         rs.Fields("SpecialtyID") = Me.List33.Column(2)
         rs.Fields("Specialty") = Me.List33.Column(3)
     Else
         rs.Fields("SpecialtyID") = Me.lstSpec.Column(0)
         rs.Fields("Specialty") = Me.lstSpec.Column(1)
     End If
     
     rs.Fields("RptDate") = Me.txtRptDt
     rs.Fields("RptPeriod") = Me.txtRptPD
     rs.Fields("ReviewBeg") = Me.txtRptBeg
     rs.Fields("ReviewEnd") = Me.txtEnd
     rs.Fields("TypeID") = Me.LstEval.Column(0)
     rs.Fields("Type") = "ACTIVE"
     
     rs.Update
     
     rs.Close
     
     Set rs = Nothing
     
 End Sub

Open in new window

0
mbizupCommented:
--->  If Len(Me.List33.Column(2)) > 0 Then

Also change this line to:

If Len(Me.List33.Column(2) & "" ) > 0 Then
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GPSPOWAuthor Commented:
thank you

worked like a charm
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.