ACC97: IPF in Msjet35.dll Running Update Against Attached TableID: Q163943
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use a user-defined function in the Update To row of an update
query based on an attached SQL Server table, you may receive the following
error message:
MSACCESS caused an invalid page fault in module MSJet35.DLL at 0137:040df209
There are two methods you can use to resolve this problem. In the first
method, you create a make-table query with a user-defined function to
create a temporary table. You then create an update query based on the
temporary table and the SQL server table. In the second method, you
perform the update manually in code.
NOTE: Both methods assume you have an attachment to the Sales table in
the PUBS sample database within Microsoft SQL Server and a function called
Test(). To create the Test() function, follow these steps:
Option Explicit
Function Test(qtyVal As Integer) As Integer
Test = qtyVal + 10
End Function
Query: qryTemp
-------------------------
Type: Select
Field: Stor_id
Field: Ord_Num
Field: Title_id
Field: Expr1: Test([qty])
Query: qryUpdate
-------------------------------------------------
Type: Update
Join: tblTemp.[Stor_id] <-> dbo_Sales.[Stor_id]
Join: tblTemp.[Ord_num] <-> dbo_Sales.[Ord_num]
Join: tblTemp.[Title_id] <-> dbo_Sales.[Title_id]
Field: [qty]
Table: dbo_Sales
Update To: [tblTemp].[Expr1]
Option Explicit
Function UpdateId()
Dim MyDb as Database
Dim MyRS as RecordSet
Dim MyVar as Long
Set MyDb = CurrentDB()
Set MyRS = MyDB.OpenRecordset("dbo_sales",dbOpenDynaset)
MyRS.MoveFirst
Do While Not MyRS.EOF
MyVar = Test([MyRS![qty])
MyRS.Edit
MyRS![qty] = MyVar
MyRS.Update
Loop
MyRS.Close
End Function
?UpdateID()
Microsoft has confirmed this to be a problem in Microsoft Access 97.
Option Explicit
Function Test(MyVar as Long) as Long
Test = MyVar /1
End Function
Query: qryTest
--------------------
Type: Update
Field: [qty]
Update To: Test(qty)
Keywords : kberrmsg QryUpdat
Version : 97
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 13, 1999