Connecting Tech Pros Worldwide Help | Site Map

access97: Object variable or Width block variable not set error

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 09:56 PM
JMCN
Guest
 
Posts: n/a
Default access97: Object variable or Width block variable not set error

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

  #2  
Old November 12th, 2005, 10:01 PM
Matthew Sullivan
Guest
 
Posts: n/a
Default Re: access97: Object variable or Width block variable not set error

It looks like you set this without first calling .Edit:[color=blue]
> Else
> rst2![DBInUse] = False
> End If[/color]

-Matt



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



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.