execution error '3021'

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D-Zyl

    execution error '3021'

    Hi everybody!

    my code is :
    *************** *************** *************** *************** *
    Private Sub Form_Open(Cance l 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.OpenRecordse t("Select repairnumber From vehicule Where
    'Immatriculatio n'=' " & myvehicule & " ';")
    rs.Edit
    rs.Fields("repa irnumber").Valu e = rs.Fields("nrep airnumber").Val ue
    + 1
    rs.Update
    Forms![new reparation]![repairnumber] =
    rs.Fields("nume roreparation"). 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
  • Tom van Stiphout

    #2
    Re: execution error '3021'

    On 26 Apr 2004 06:33:31 -0700, d_zyl38@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, numeroreparatio n.

    -Tom.


    [color=blue]
    >Hi everybody!
    >
    >my code is :
    >************** *************** *************** *************** **
    >Private Sub Form_Open(Cance l 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.OpenRecordse t("Select repairnumber From vehicule Where
    >'Immatriculati on'=' " & myvehicule & " ';")
    > rs.Edit
    > rs.Fields("repa irnumber").Valu e = rs.Fields("nrep airnumber").Val ue
    >+ 1
    > rs.Update
    > Forms![new reparation]![repairnumber] =
    >rs.Fields("num eroreparation") .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[/color]

    Comment

    • Randy Harris

      #3
      Re: execution error '3021'


      "D-Zyl" <d_zyl38@hotmai l.com> wrote in message
      news:ef7e39ee.0 404260533.1a57a fd1@posting.goo gle.com...[color=blue]
      > Hi everybody!
      >
      > my code is :
      > *************** *************** *************** *************** *
      > Private Sub Form_Open(Cance l 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.OpenRecordse t("Select repairnumber From vehicule Where
      > 'Immatriculatio n'=' " & myvehicule & " ';")
      > rs.Edit
      > rs.Fields("repa irnumber").Valu e = rs.Fields("nrep airnumber").Val ue
      > + 1
      > rs.Update
      > Forms![new reparation]![repairnumber] =
      > rs.Fields("nume roreparation"). Value
      > rs.Close
      > Set rs = Nothing
      > Set db = Nothing
      > End Sub
      > *************** *************** *************** ***************[/color]

      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.


      Comment

      Working...