B
Bob
Can someone tell explain why this works in one DB and not
in the new one I am trying to create.
Private Sub FIELDNAME_NotInList(NewData As String,
Response As Integer)
Dim strmsg As String
Dim rst As Recordset
Dim db As Database
Const MB_YESNO = 4
Const MB_Question = 32
Const IDNO = 7
strmsg = "'" & NewData & "' is not in list. "
strmsg = strmsg & "Would you like to ad it?"
If MsgBox(strmsg, MB_YESNO + MB_Question, "New
Question") = IDNO Then
Response = DATA_ERRDISPLAY
Else
Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("TABLENAME") <<<<
IT ERRORS OUT HERE "type mismatch ERR0R 13"
rst.AddNew
rst("FIELDNAME") = NewData
rst.Update
Response = DATA_ERRADDED
rst.Close
End If
End Sub
If I change the TABLENAME to something that doesn't exist
the error message that comes up I can understand >> "
The Microsoft Jet database engine cannot find the input
table or query <name>. Make sure it exists and that its
name is spelled correctly. (Error 3078)"
in the new one I am trying to create.
Private Sub FIELDNAME_NotInList(NewData As String,
Response As Integer)
Dim strmsg As String
Dim rst As Recordset
Dim db As Database
Const MB_YESNO = 4
Const MB_Question = 32
Const IDNO = 7
strmsg = "'" & NewData & "' is not in list. "
strmsg = strmsg & "Would you like to ad it?"
If MsgBox(strmsg, MB_YESNO + MB_Question, "New
Question") = IDNO Then
Response = DATA_ERRDISPLAY
Else
Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("TABLENAME") <<<<
IT ERRORS OUT HERE "type mismatch ERR0R 13"
rst.AddNew
rst("FIELDNAME") = NewData
rst.Update
Response = DATA_ERRADDED
rst.Close
End If
End Sub
If I change the TABLENAME to something that doesn't exist
the error message that comes up I can understand >> "
The Microsoft Jet database engine cannot find the input
table or query <name>. Make sure it exists and that its
name is spelled correctly. (Error 3078)"