473,386 Members | 1,924 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,386 software developers and data experts.

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
Nov 12 '05 #1
1 1714
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Lauren Quantrell | last post by:
I get the following error: "Object variable or Width block variable not set error" trying to run this in my Access2000 .ADP database: CurrentDb.Properties.Append...
1
by: JMCN | last post by:
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...
2
by: Eugenio | last post by:
Sorry in advance for my english. :-) I have a form MS Access97 with two subforms. These subforms have different data and dimensions, if into the main form I've selected with checkbox "Date of...
6
by: Neo Geshel | last post by:
I am trying to deal with an image in code-behind. I consistently get the following error: Server Error in '/' Application. Object variable or With block variable not set. Description: An...
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
1
by: MarkAllison | last post by:
Hi, can anyone help me before I slit my wrists?!?! I am trying to create a procedure in an Access 97 database, that basically creates a new record in a table called "Discrepancies", with an ID...
3
by: Newbie19 | last post by:
I'm trying to get a list of all subfolders in a folder on a share drive, but I keep on getting this error message: Object variable or With block variable not set. Description: An unhandled...
1
by: finizaini | last post by:
I'm receiving an "Object Expected" Error (Line:309, Char:0). I'm confused as to what is happening.Also, I can't run this code using other browser such as Fire Fox. Thispage only can view using IE....
2
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.