Question : DAO Recordset issue Access 2007 VBA

I have my access linked to mysql. I have a cutsomer form and from the customer form I need to add events. The code below is what I am using to add the events through VBA.  I am getting an ODBC call failed from this code but I have other DAO recordset code in the form similar to this and works without issues.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Dim db As DAO.Database
Dim rst As DAO.Recordset
 
Set db = CurrentDb
Set rst = db.OpenRecordset("eventsite" & LTrim(RTrim(Str(Main.colony))), dbOpenDynaset)
   rst.AddNew
   rst("ID").Value = Me.id
   rst("eventDt").Value = event1
   rst("Event").Value = "party"
   rst.Update
   rst.AddNew
   rst("mouseID").Value = Me.id
   rst("eventDT").Value = event2
   rst("Event").Value = "Party2"
   rst.Update
   rst.Close

Answer : DAO Recordset issue Access 2007 VBA

Annoying. This is the type of situations which I would prefer to examine hands on.

From the Immediate Pane, you can type: ? rst.Updatable. But come to think of it, the error would occur on rst.AddNew, not rst.Update.

For one reason or another, the update is rejected. Are there validation rules for the table, required fields, something like that? If you fill the same table elsewhere, do you use a different ID number? different dates? It could be a key validation. Who knows if the message is so cryptic.

(°v°)
Random Solutions  
 
programming4us programming4us