473,377 Members | 1,119 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,377 software developers and data experts.

Corruption Error?

102 64KB
Background: Frontend MS Access 2010/VBA, Backend MS SQL Server 2008

I get the attached error message on a form. It just started to show up and I do not know why (corrupt module maybe). Have any of you seen this and what did you do to overcome?
Attached Files
File Type: docx Doc1.docx (242.1 KB, 345 views)
Jun 9 '15 #1
1 1095
jforbes
1,107 Expert 1GB
These are the things that I run into that can cause this:

The First is that something has gotten out of whack with the currently compiled code. Making a change and then recompiling can fix it.

The Second is when using ODBC to link to a SQL View where the View has a * in the Select statement. The * in the View doesn't flag the View as dependent on the underlying Table, so when the Table changes, the Metadata for the View also needs to be updated, unfortunately by hand.
To fix this one, I run this pretty awesome script against the SQL Database to refresh it's metadata, then use the Link Table Manager in Access to refresh the SQL Info for the Views and Tables:
Expand|Select|Wrap|Line Numbers
  1. --Source: http://blog.devart.com/refreshing-objects-of-sql-server-databases.html
  2.  
  3. --USE [your_db] 
  4. --GO 
  5. PRINT ' -- Refreshing all VIEWS in database ' + QUOTENAME(DB_NAME()) + ' :' 
  6. DECLARE @stmt_refresh_object nvarchar(400) 
  7. DECLARE c_refresh_object CURSOR FOR 
  8. SELECT DISTINCT 
  9.   'EXEC sp_refreshview '''+QUOTENAME(ss.name)+'.'+QUOTENAME(so.name)+'''' AS stmt_refresh_views 
  10. FROM sys.objects AS so
  11. INNER JOIN sys.sql_expression_dependencies AS sed
  12. ON so.object_id = sed.referencing_id
  13. INNER JOIN sys.schemas AS ss
  14. ON so.schema_id = ss.schema_id 
  15. WHERE so.type = 'V' AND sed.is_schema_bound_reference = 0 
  16.  
  17. OPEN c_refresh_object 
  18. FETCH NEXT FROM c_refresh_object 
  19. INTO @stmt_refresh_object 
  20. WHILE @@FETCH_STATUS = 0    
  21. BEGIN       
  22.    PRINT @stmt_refresh_object
  23.    exec sp_executesql @stmt_refresh_object
  24.    FETCH NEXT FROM c_refresh_object 
  25.    INTO @stmt_refresh_object    
  26. END
  27. CLOSE c_refresh_object 
  28. DEALLOCATE c_refresh_object 
  29. GO 
  30.  
  31.  
  32. PRINT ' -- Refreshing all DML TRIGGERS in database ' + QUOTENAME(DB_NAME()) + ' :'
  33. DECLARE @stmt_refresh_object nvarchar(400) 
  34. DECLARE c_refresh_object CURSOR FOR 
  35. SELECT DISTINCT 
  36.   'EXEC sp_refreshsqlmodule '''+QUOTENAME(schemas.name)+'.'+QUOTENAME(triggers.name)+'''' AS stmt_refresh_dml_triggers 
  37. FROM sys.triggers AS triggers WITH(NOLOCK)   
  38. INNER JOIN sys.objects AS objects WITH(NOLOCK)       
  39. ON objects.object_id = triggers.parent_id   
  40. INNER JOIN sys.schemas AS schemas WITH(NOLOCK)       
  41. ON schemas.schema_id = objects.schema_id   
  42. LEFT JOIN sys.sql_modules AS sql_modules WITH(NOLOCK)       
  43. ON sql_modules.object_id = triggers.object_id   
  44. LEFT JOIN sys.assembly_modules AS assembly_modules WITH(NOLOCK)       
  45. ON assembly_modules.object_id = triggers.object_id   
  46. LEFT JOIN sys.assemblies AS assemblies WITH(NOLOCK)       
  47. ON assemblies.assembly_id = assembly_modules.assembly_id   
  48. LEFT JOIN sys.database_principals AS principals WITH(NOLOCK)       
  49. ON principals.principal_id = assembly_modules.execute_as_principal_id         
  50. OR principals.principal_id = sql_modules.execute_as_principal_id 
  51. WHERE RTRIM(objects.type) IN ('U','V') and parent_class = 1      
  52. AND sql_modules.is_schema_bound = 0 
  53.  
  54. OPEN c_refresh_object 
  55. FETCH NEXT FROM c_refresh_object 
  56. INTO @stmt_refresh_object 
  57. WHILE @@FETCH_STATUS = 0    
  58. BEGIN       
  59.    print @stmt_refresh_object        
  60.    exec sp_executesql @stmt_refresh_object       
  61.    FETCH NEXT FROM c_refresh_object 
  62.    INTO @stmt_refresh_object    
  63. END
  64. CLOSE c_refresh_object 
  65. DEALLOCATE c_refresh_object 
  66. GO 
  67.  
  68.  
  69. PRINT ' -- Refreshing all PROCEDURES in database ' + QUOTENAME(DB_NAME()) + ' :'
  70. DECLARE @stmt_refresh_object nvarchar(400) 
  71. DECLARE c_refresh_object CURSOR FOR
  72. SELECT DISTINCT 
  73.   'EXEC sp_refreshsqlmodule '''+QUOTENAME(s.name)+'.'+QUOTENAME(p.name)+'''' AS stmt_refresh_procedures 
  74. FROM  sys.procedures AS p WITH(NOLOCK) 
  75. LEFT JOIN  sys.schemas AS s WITH(NOLOCK)      
  76. ON p.schema_id = s.schema_id 
  77. LEFT JOIN  sys.sql_modules AS sm WITH(NOLOCK)      
  78. ON p.object_id = sm.object_id 
  79. LEFT JOIN  sys.assembly_modules AS am WITH(NOLOCK)      
  80. ON p.object_id = am.object_id 
  81. LEFT JOIN  sys.assemblies AS a      
  82. ON a.assembly_id = am.assembly_id 
  83. LEFT JOIN  sys.objects AS o WITH(NOLOCK)      
  84. ON sm.object_id = o.object_id 
  85. LEFT JOIN  sys.database_principals AS dp WITH(NOLOCK)      
  86. ON sm.execute_as_principal_id = dp.principal_id          
  87. OR am.execute_as_principal_id = dp.principal_id 
  88. LEFT JOIN  sys.database_principals AS dp1 WITH(NOLOCK)      
  89. ON o.principal_id = dp1.principal_id 
  90. WHERE (CAST(CASE WHEN p.is_ms_shipped = 1 THEN 1
  91.                  WHEN (SELECT major_id 
  92.                        FROM sys.extended_properties 
  93.                        WHERE major_id = p.object_id AND minor_id = 0 AND class = 1 AND name = 'microsoft_database_tools_support'
  94.                        ) IS NOT NULL THEN 1             
  95.                  ELSE 0 END AS bit
  96.             )=0
  97.        )
  98. OPEN c_refresh_object 
  99. FETCH NEXT FROM c_refresh_object 
  100. INTO @stmt_refresh_object 
  101. WHILE @@FETCH_STATUS = 0    
  102. BEGIN       
  103.    PRINT @stmt_refresh_object        
  104.    exec sp_executesql @stmt_refresh_object       
  105.    FETCH NEXT FROM c_refresh_object INTO @stmt_refresh_object    
  106. END
  107. CLOSE c_refresh_object 
  108. DEALLOCATE c_refresh_object 
  109. GO 
  110.  
  111. PRINT ' -- Refreshing all FUNCTIONS in database ' + QUOTENAME(DB_NAME()) + ' :'
  112. DECLARE @stmt_refresh_object nvarchar(400) 
  113. DECLARE c_refresh_object CURSOR FOR
  114. SELECT DISTINCT 'EXEC sp_refreshsqlmodule '''+QUOTENAME(SCHEMA_NAME(o.schema_id))+'.'+QUOTENAME(o.name)+'''' AS stmt_refresh_functions 
  115. FROM sys.objects AS o WITH(NOLOCK)   
  116. LEFT JOIN sys.sql_modules AS sm WITH(NOLOCK)        
  117. ON o.object_id = sm.object_id   
  118. LEFT JOIN sys.assembly_modules AS am WITH(NOLOCK)        
  119. ON o.object_id = am.object_id   
  120. LEFT JOIN sys.database_principals p1 WITH(NOLOCK)        
  121. ON p1.principal_id = o.principal_id   
  122. LEFT JOIN sys.database_principals p2 WITH(NOLOCK)        
  123. ON p2.principal_id=am.execute_as_principal_id   
  124. LEFT JOIN sys.database_principals p3 WITH(NOLOCK)        
  125. ON p3.principal_id=sm.execute_as_principal_id   
  126. LEFT JOIN sys.assemblies AS ass WITH(NOLOCK)        
  127. ON ass.assembly_id = am.assembly_id 
  128. WHERE o.type IN ('FN','IF','TF','AF','FS','FT') and sm.is_schema_bound = 0 
  129. OPEN c_refresh_object 
  130. FETCH NEXT FROM c_refresh_object 
  131. INTO @stmt_refresh_object 
  132. WHILE @@FETCH_STATUS = 0    
  133. BEGIN       
  134.    PRINT @stmt_refresh_object        
  135.    exec sp_executesql @stmt_refresh_object       
  136.    FETCH NEXT FROM c_refresh_object INTO @stmt_refresh_object    
  137. END
  138. CLOSE c_refresh_object 
  139. DEALLOCATE c_refresh_object 
  140. GO 
  141.  
  142. PRINT ' -- Refreshing all DDL TRIGGERS on database ' + QUOTENAME(DB_NAME()) + ' :'
  143. DECLARE @stmt_refresh_object nvarchar(400) 
  144. DECLARE c_refresh_object CURSOR FOR
  145. SELECT DISTINCT 'EXEC sp_refreshsqlmodule '''+QUOTENAME(t.name)+''','+'''DATABASE_DDL_TRIGGER''' as stmt_refresh_ddl_triggers 
  146. FROM sys.triggers AS t WITH(NOLOCK)   
  147. LEFT JOIN sys.sql_modules AS sm WITH(NOLOCK)       
  148. ON t.object_id = sm.object_id   
  149. LEFT JOIN sys.assembly_modules AS am WITH(NOLOCK)       
  150. ON t.object_id = am.object_id   
  151. LEFT JOIN sys.assemblies AS assemblies WITH(NOLOCK)       
  152. ON assemblies.assembly_id = am.assembly_id   
  153. LEFT JOIN sys.database_principals AS principals WITH(NOLOCK)       
  154. ON principals.principal_id = sm.execute_as_principal_id          
  155. OR principals.principal_id = am.execute_as_principal_id 
  156. WHERE parent_class = 0 
  157. OPEN c_refresh_object 
  158. FETCH NEXT FROM c_refresh_object 
  159. INTO @stmt_refresh_object 
  160. WHILE @@FETCH_STATUS = 0    
  161. BEGIN       
  162.    print @stmt_refresh_object        
  163.    exec sp_executesql @stmt_refresh_object       
  164.    FETCH NEXT FROM c_refresh_object INTO @stmt_refresh_object    
  165. END
  166. CLOSE c_refresh_object 
  167. DEALLOCATE c_refresh_object 
  168.  
  169. PRINT 'Metadata update for non-schema-bound objects is done.'
  170.  
Jun 9 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jonathan Patton | last post by:
------_=_NextPart_001_01C35A98.861F1984 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have mysql setup on two computers with identical databases....
7
by: Ed L. | last post by:
We are seeing what looks like pgsql data file corruption across multiple clusters on a RAID5 partition on a single redhat linux 2.4 server running 7.3.4. System has ~20 clusters installed with a...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
4
by: Mark | last post by:
I have a form defined that when compiling has started giving me an error message I can't make any sense of... FormFind.h(24): error C3830: 'System::IntPtr': value types can only inherit from a...
2
by: Marc Gravell | last post by:
Aaarrggghhh! Maybe I've just got lucky, but until now I haven't had such a seemingly unrecoverable form corruption error... I have a reasonably complex form (data-binding to sub-controls, events,...
1
by: cuj0 | last post by:
Does anyone know what might cause the "The viewstate is invalid for this page and might be corrupted" error to occur every time users try to do something that results in a postback on a particular...
4
by: Tomassus | last post by:
Hi there, I have a problem with dynamic memory allocation. I know that it would have been easier to use vectors methods, but i want to know what i do here wrong. This is one of my methods in...
18
by: NEWSGROUPS | last post by:
I work for a large organization were my team has developed 2 very substantial databases in Access 2000. These databases have been working fine for the last 6 years with minimal issues or problems....
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.