473,396 Members | 2,061 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,396 software developers and data experts.

execution error '3021'

Hi everybody!

my code is :
************************************************** ***********
Private Sub Form_Open(Cancel As Integer)

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim myvehicule As String

myvehicule = Forms![Mapping]![Immatriculation]
Set db = CurrentDb
Set rs = db.OpenRecordset("Select repairnumber From vehicule Where
'Immatriculation'=' " & myvehicule & " ';")
rs.Edit
rs.Fields("repairnumber").Value = rs.Fields("nrepairnumber").Value
+ 1
rs.Update
Forms![new reparation]![repairnumber] =
rs.Fields("numeroreparation").Value
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
************************************************** **********

and I get the #3021 error.
Does anybody see where the trouble is ??????

thanks a lot
Nov 12 '05 #1
2 3006
On 26 Apr 2004 06:33:31 -0700, d_*****@hotmail.com (D-Zyl) wrote:

The debugger knows. Use it. Set a breakpoint at the top of the code
and step through the procedure.

One problem I see with your code is that you spell RepairNumber 3
different ways: repairnumber, nrepairnumber, numeroreparation.

-Tom.
Hi everybody!

my code is :
************************************************* ************
Private Sub Form_Open(Cancel As Integer)

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim myvehicule As String

myvehicule = Forms![Mapping]![Immatriculation]
Set db = CurrentDb
Set rs = db.OpenRecordset("Select repairnumber From vehicule Where
'Immatriculation'=' " & myvehicule & " ';")
rs.Edit
rs.Fields("repairnumber").Value = rs.Fields("nrepairnumber").Value
+ 1
rs.Update
Forms![new reparation]![repairnumber] =
rs.Fields("numeroreparation").Value
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
************************************************* ***********

and I get the #3021 error.
Does anybody see where the trouble is ??????

thanks a lot


Nov 12 '05 #2

"D-Zyl" <d_*****@hotmail.com> wrote in message
news:ef**************************@posting.google.c om...
Hi everybody!

my code is :
************************************************** ***********
Private Sub Form_Open(Cancel As Integer)

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim myvehicule As String

myvehicule = Forms![Mapping]![Immatriculation]
Set db = CurrentDb
Set rs = db.OpenRecordset("Select repairnumber From vehicule Where
'Immatriculation'=' " & myvehicule & " ';")
rs.Edit
rs.Fields("repairnumber").Value = rs.Fields("nrepairnumber").Value
+ 1
rs.Update
Forms![new reparation]![repairnumber] =
rs.Fields("numeroreparation").Value
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
************************************************** **********


If Immatriculation is a field in the vehicule table, you don't want quotes
around it in the SQL statement where you open the recordset.
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Colin Graham | last post by:
I am writing this piece of code to show the previous record on a control on the form but i keep getting the error message "Error 3021 no current record " and the line marked *** gets highlighted. I...
9
by: Robert Wing | last post by:
I support an MS Access application in which errors are trapped using the On Error statement. Just recently, the users of this system have experienced run-time error number 3021 on a random basis. ...
2
by: D-Zyl | last post by:
Hi everybody! my code is : ************************************************************* Private Sub Form_Open(Cancel As Integer) Dim db As DAO.Database Dim rs As DAO.Recordset Dim...
2
by: dixie | last post by:
Can someone please give me the error number for this error? dixie
3
by: windandwaves | last post by:
Hi, I am trying to make errors a bit more meaningful for my users. I am trying to fix error 3201 where there is a missing field in a form. If I do not do any error trapping, then I get ...
2
by: Robert | last post by:
I have a label on my form lblCount and the following code in my form for displaying a record count: Private Sub Form_Current() Me.RecordsetClone.Bookmark = Me.Bookmark Me!lblCount.Caption =...
7
by: ruvi | last post by:
I am getting runtime error 3021 - Either EOF or BOF is true or the current record has been deleted..... I have 2 combo boxes in a form- One for the client and the other for the project. When the...
8
by: fish919 | last post by:
Hello All, I am having a little trouble with my database. The Database has a parent table with 5 or 6 children tables in it they are linked by a common id filed. The problem is that the...
0
by: bssandeshbs | last post by:
I am developing a Address Book Database Project using Visual Basic 6... When i click the delete button the data does'nt get deleted in the FrontEnd ..But it gets deleted in Database when we see in...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.