docmd.RunSql problem 
Author Message
 docmd.RunSql problem

First, I have a table in SQL Server which is linked in MS-
Access 2002.  In a module, I have this code written

DoCmd.RunSQL "UPDATE ExportReset " & _
             "SET ExportDateTime = Now() " & _
             "WHERE ExportDateTime < Now();"

When this line is executed, I get an error (exception) as
follows, "Operation must use an updateable query".  What
would cause this error, and what would be a solution?

Thanks



Sun, 30 Oct 2005 21:50:00 GMT  
 docmd.RunSql problem
Jack,

Is ExportReset a table or a query? My guess is that it's a query - and one
that's non-updatable. Since you're updating a single field only, update the
table.

By the way, you really should use db.Execute, rather than DoCmd.RunSQL. Have
a look at the online Help.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia



Quote:
> First, I have a table in SQL Server which is linked in MS-
> Access 2002.  In a module, I have this code written

> DoCmd.RunSQL "UPDATE ExportReset " & _
>              "SET ExportDateTime = Now() " & _
>              "WHERE ExportDateTime < Now();"

> When this line is executed, I get an error (exception) as
> follows, "Operation must use an updateable query".  What
> would cause this error, and what would be a solution?

> Thanks



Sun, 30 Oct 2005 22:45:58 GMT  
 docmd.RunSql problem
I put the update statement in a query through the query
wizard.  Then I used DoCmd.OpenQuery.  Then I relinked the
SQL Server table in Access.  It asked me to select the
table's field that would be used in selects and updates.  
This fixed the problem!
Quote:
>-----Original Message-----
>First, I have a table in SQL Server which is linked in MS-
>Access 2002.  In a module, I have this code written

>DoCmd.RunSQL "UPDATE ExportReset " & _
>             "SET ExportDateTime = Now() " & _
>             "WHERE ExportDateTime < Now();"

>When this line is executed, I get an error (exception) as
>follows, "Operation must use an updateable query".  What
>would cause this error, and what would be a solution?

>Thanks

>.



Mon, 31 Oct 2005 00:04:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. docmd.runsql repeat problem

2. DoCmd.RunSQL

3. DoCmd.RunSQL Error

4. DoCmd.RunSQL error 2

5. docmd.RunSQL String Concatenation

6. DoCmd.RunSQL too long record

7. DoCmd.RunSQL

8. suppress warnings on DoCmd.RunSQL ?

9. docmd.runsql help required

10. DoCmd.RunSQL vs. Recordsets

11. docmd.runSQL fails on Windows 2000

12. Quick syntax question on - DoCmd.RunSQL

 

 
Powered by phpBB® Forum Software