Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Lin100
Yak Posting Veteran
70 Posts |
Posted - 2006-09-13 : 21:58:17
|
Access 2002 and SQL 2000 ServerDatabase Type is MDB: Inspection.MDB If the table Table_User_Log_On has no index or primary key, the code below would work.If I created an index on the field named "name", then the code below would work also.If I created a primary key on the field named "name", then the code below would gives me an error. Run-Time error. ODBC - Call failed.''''''''''''''''''''''''''''''''''''''''''''''''cmd.CommandText = "INSERT INTO Table_User_Log_On ( Name, Date_And_Time_Log_On, Department_Group, Access_Status) Values " _& "('" & RecordSet_User_Account!Name & "', '" & Now() & "', '" & RecordSet_User_Account!Department_Group & "', '" & RecordSet_User_Account!Access_Status & "')"cmd.Execute , , adCmdText <----- code died. Yellow highlight |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-13 : 22:29:08
|
Have you tried executing the same query in Query Analyser to see what the problem is?My money is on a duplicate entry in the table.btw - A column name of 'Name' is not recommended. It's best to steer clear of using SQL Server reserved words as your column names. |
 |
|
|
|
|