By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,503 Members | 2,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,503 IT Pros & Developers. It's quick & easy.

access97: Object variable or Width block variable not set error

P: n/a
hello-
i received an runtime error message: You tried to call Update or
CancelUpdate or attempted to update a Field in a recordset without
first calling AddNew or Edit. (Error 3020). when i look through my
code again, i thought that i called the Edit methode before i tried to
update the [DBInUse] field.

thanks in advance, jung

here is the following code:
Dim rst, rst2, rstmySQL As Recordset
Dim db As Database
Dim mysSQL As String

Set db = CurrentDb
Set rst = db.OpenRecordset("DailyCreateExceptionReport")
Set rst2 = db.OpenRecordset("DBInUse")

'Locks the database so that others cannot add more loans to the record
set while running the AutoCreator

Do Until rst.EOF
If rst![CreatedMoved] = True Then
'look up the database for the loan to be created.
If rst![Database] = rst2![DBName] Then
With rst
.Edit
![DBInUse] = True 'Object variable or Width block
variable not set error
.Update
End With
Else
rst2![DBInUse] = False
End If
Else
With rst2
.Edit
![DBInUse] = False
.Update
End With
End If
'x = x + 1
rst.MoveNext
Loop

If rst2![DBInUse] = True Then 'yes
MsgBox "The AutoCreator feature cannot run due to a sharing
voilation." & (Chr(13) & Chr(10)) & _
"Another user is running the CREA*18/MOVE*18 in the
selected database." & (Chr(13) & Chr(10)) & _
"Please select another database to use the AutoCreator
feature.", vbCritical
Else
Forms![F-Main]![WorkWindow].SourceObject = "Plate_AutoCreator"
End If

Set rst = Nothing
Set rst2 = Nothing
Set db = Nothing
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It looks like you set this without first calling .Edit:
Else
rst2![DBInUse] = False
End If


-Matt

On 21 Apr 2004 06:11:14 -0700, pi******@yahoo.fr (JMCN) wrote:

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.