D
DaBartman
Hi guys,
New to Access, so please be kind
The following has been working just fine. Now I get a 'Type Mismatch' error
#13 in the highlighted line. Do not understand this.
Public Sub NewDataAddition(strNewData As String, strTable As String)
Dim db As Database
Dim rec As Recordset ' Adds new data to Casinos and Games tables
Set db = CurrentDb()
Set rec = db.OpenRecordset(strTable) ' this is the offending line
rec.MoveFirst
Do While Not rec.EOF
If rec.Fields(0) <> strNewData Then
rec.MoveNext
Else
rec.Close
Exit Sub
End If
Loop
rec.AddNew
rec.Fields(0) = strNewData
rec.Update
rec.Close
End Sub
New to Access, so please be kind
The following has been working just fine. Now I get a 'Type Mismatch' error
#13 in the highlighted line. Do not understand this.
Public Sub NewDataAddition(strNewData As String, strTable As String)
Dim db As Database
Dim rec As Recordset ' Adds new data to Casinos and Games tables
Set db = CurrentDb()
Set rec = db.OpenRecordset(strTable) ' this is the offending line
rec.MoveFirst
Do While Not rec.EOF
If rec.Fields(0) <> strNewData Then
rec.MoveNext
Else
rec.Close
Exit Sub
End If
Loop
rec.AddNew
rec.Fields(0) = strNewData
rec.Update
rec.Close
End Sub