Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch after save?

Status
Not open for further replies.

Quixxx

Technical User
Joined
Aug 9, 2007
Messages
9
Location
CA
Hello all,

I can't figure out why I am getting a type mismatch error after my save.

Here is my code

Private Sub cmdSaveDOCS_Click()
Dim recIND As Integer
Dim strSQL As String
Dim i As Integer

recIND = txtRVA

strSQL = "Select * from tblPhysicians"

Set rstSet = CurrentDb.OpenRecordset(strSQL)
For i = 1 To lstDOCS.ListCount - 1

Me.lstDOCS = Me.lstDOCS.ItemData(i)
With rstSet
.AddNew
.Fields("rvaNumber") = recIND
.Fields("docFirstNAME") = lstDOCS.Column(2)
.Fields("docSecondNAME") = lstDOCS.Column(3)
.Fields("docBillingNUM") = lstDOCS.Column(0)
.Fields("docGroupNUM") = lstDOCS.Column(1)
.Fields("effectiveDate") = CDate(lstDOCS.Column(4))
End With
rstSet.Update
Next i
Set rstSet = Nothing

MsgBox "All physicians have been added to this RVA.", , "Complete"
DoCmd.Close "frmAddDOCS-2"

End Sub


Any ideas?

Thanks!!
 
You have not declared rstSet:

Dim rstSet As DAO.Recordset

Make sure you have a reference to the Microsoft DAO 3.x Object Library.

You do not have .Update, either.
 
I made the changes... I guess I was lazy with the rstSet.

I still receive the error though...

it breaks at the last line when I am trying to close the form.

Private Sub cmdSaveDOCS_Click()
Dim recIND As Integer
Dim strSQL As String
Dim i As Integer
Dim rstSet As DAO.Recordset
recIND = txtRVA

strSQL = "Select * from tblPhysicians"

Set rstSet = CurrentDb.OpenRecordset(strSQL)
For i = 1 To lstDOCS.ListCount - 1

Me.lstDOCS = Me.lstDOCS.ItemData(i)
With rstSet
.AddNew
.Fields("rvaNumber") = recIND
.Fields("docFirstNAME") = lstDOCS.Column(2)
.Fields("docSecondNAME") = lstDOCS.Column(3)
.Fields("docBillingNUM") = lstDOCS.Column(0)
.Fields("docGroupNUM") = lstDOCS.Column(1)
.Fields("effectiveDate") = CDate(lstDOCS.Column(4))
.Update
End With
Next i
Set rstSet = Nothing

MsgBox "All physicians have been added to this RVA.", , "Complete"
DoCmd.Close "frmAddDOCS-2"


End Sub
 
That would be:

DoCmd.Close acForm, "frmAddDOCS-2
 
That worked

Thanks a million!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top