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

execution error '3021'

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

"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 discussion thread is closed

Replies have been disabled for this discussion.