I'm not certain what broke it, but I have some code for updating a database which no longer works. It's important that I get this working today, so any help would be greately appreciated. I'm using an Access 97 database with and ADO data control from VB 6. The SQL I use to populate the data control contains an inner join, in case it's important. I also played around with adding relationships and cascading updates to it a while ago, but decided against it and removed them. (May not be important, but you never know.)
Everything goes fine up until I do an UpdateBatch on the data control's recordset. At that point, I get the following unhelpful error message:
Run-time error '-2147467259 (80004005)':
Insufficient key column information fot updating or refreshing.
A quick search of MSDN turned up only one match on this particular message. However it had to do with joining tables where the primary key of one table matches a column in the other. However, my column names are all unique across tables, so that doesn't apply.
In case it helps, here's the code I use to populate the data control:
Has anybody ever seen this error before, or have any idea what could be causing it? I suspect it's something with the database itself, as I haven't done much to the code, but I have no idea what the problem is. Can someone please give me a hand?
Everything goes fine up until I do an UpdateBatch on the data control's recordset. At that point, I get the following unhelpful error message:
Run-time error '-2147467259 (80004005)':
Insufficient key column information fot updating or refreshing.
A quick search of MSDN turned up only one match on this particular message. However it had to do with joining tables where the primary key of one table matches a column in the other. However, my column names are all unique across tables, so that doesn't apply.
In case it helps, here's the code I use to populate the data control:
Code:
SQL = "SELECT ak_site, kr_veh_dept, kr_tran_num, kr_veh_no, ak_employee_no, ak_empl_dept, empl_first_name, " & _
"empl_last_name, kr_date, kr_time, kr_pr, kr_qty, kr_odom FROM tranfile INNER JOIN emplfile " & _
"ON tranfile.ak_employee_no = emplfile.empl_number"
'...Irrelevant stuff omitted
With TransDC
.CursorLocation = adUseClient
.LockType = adLockBatchOptimistic
.CursorType = adOpenDynamic
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Persist Security Info=False;Data Source=" & db_name & ";"
.RecordSource = SQL
.Refresh
End With