Re: Access VBA update recordset error

From: cityofgp (cityofgp_at_discussions.microsoft.com)
Date: 10/29/04

  • Next message: Victor Koch: "Re: Access VBA update recordset error"
    Date: Fri, 29 Oct 2004 10:57:02 -0700
    
    

    This is what the exact error message says:
    Runtime error '-2147467259 (80004005)':

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
    statement.

    And when I click on debug and takes me to the .update statement.

    "Brendan Reynolds" wrote:

    > I still can't see the problem. The spaces in the field names should not, as
    > far as I can see, be a problem as long as you surround them with square
    > brackets, as you are doing. But here's something that might help to narrow
    > down the problem - try aliasing those field names in a SQL statement,
    > something like so ...
    >
    > Dim strSQL As String
    > ....
    > strSQL = "SELECT Roll, ReferenceRoll, LOCCD, BLDNO, UNIT, TENANT,
    > BusinessAddress, [Bus PC] AS BusPC etc. FROM tblbrzaccounts"
    > ....
    > ..Open strSQL, dbconn, , adLockOptimistic
    > ....
    > !BusPC = txtPC
    > ....
    >
    > Also, it might help to know the exact text of the error message.
    >
    > --
    > Brendan Reynolds (MVP)
    > http://brenreyn.blogspot.com
    >
    > The spammers and script-kiddies have succeeded in making it impossible for
    > me to use a real e-mail address in public newsgroups. E-mail replies to
    > this post will be deleted without being read. Any e-mail claiming to be
    > from brenreyn at indigo dot ie that is not digitally signed by me with a
    > GlobalSign digital certificate is a forgery and should be deleted without
    > being read. Follow-up questions should in general be posted to the
    > newsgroup, but if you have a good reason to send me e-mail, you'll find
    > a useable e-mail address at the URL above.
    >
    >
    > "cityofgp" <cityofgp@discussions.microsoft.com> wrote in message
    > news:60080A55-354E-482D-ADB0-DE901E87ED2F@microsoft.com...
    > > Here is the code that executes on the 'onclick' event.
    > > You will notice I have commented the fieldnames that have spaces because
    > > when I uncomment, I get the error message.
    > >
    > > Dim rs As ADODB.Recordset
    > > Dim dbconn As ADODB.Connection
    > > Dim rate As Integer
    > > Dim amount As Integer
    > > Set dbconn = New ADODB.Connection
    > > dbconn.ConnectionString = "DSN=BRZ;"
    > > dbconn.Open
    > >
    > > Set rs = New ADODB.Recordset
    > > With rs
    > > .Open "tblbrzaccounts", dbconn, , adLockOptimistic
    > > .AddNew
    > > !ROLL = txtRoll
    > > !ReferenceRoll = txtRollRef
    > > !LOCCD = txtLOCCD
    > > !BLDNO = txtBLDNO
    > > !UNIT = UNIT
    > > !TENANT = txtTenant
    > > ![BusinessAddress] = txtAddress
    > > '![Bus PC] = txtPC
    > > !TenantName = txtTenantName
    > > !BusinessName = txtBusName
    > > !MailingAddress1 = txtMailAdd1
    > > !MailingAddress2 = txtMailAdd2
    > > !City = txtCity
    > > !Prov = txtProv
    > > !MailingPC = txtBillPC
    > > !Country = txtBillCountry
    > > !BUSPHONE = txtWork
    > > !BusinessRepName = txtBusRepName
    > > !LessorsName = txtLessor
    > > !LSSRPHONE = txtPhone
    > > !Comments = txtComments
    > > !CHANGESystem = txtChanges
    > > !Start = txtStart
    > > !End = txtEnd
    > > '![Tentan TypeCode] = txtTenTypeCode
    > > !Size = txtSize
    > > !AssessmentCode = txtAssessmentCode
    > > !BusinessType = txtBusType
    > > '![Tax Status] = txtTaxStatus
    > > '![Millrate Code] = txtMillrateCode
    > > '![Current Assmt] = txtCurrentAssmt
    > > ![2003TaxPrevAsmt] = txt2003PrevAssmt
    > > !Status = txtStatus
    > > '![Drive Code] = CStr(txtLOCCD & "-" & txtBLDNO & txtUnit &
    > > txtTenant)
    > > .Update
    > > End With
    > > rs.Close
    > > dbconn.Close
    > > MsgBox "saved"
    > >
    > > "Brendan Reynolds" wrote:
    > >
    > >> I think we'll need to see the actual code to trouble-shoot this one. The
    > >> full text of the error message might help, too.
    > >>
    > >> --
    > >> Brendan Reynolds (MVP)
    > >> http://brenreyn.blogspot.com
    > >>
    > >> The spammers and script-kiddies have succeeded in making it impossible
    > >> for
    > >> me to use a real e-mail address in public newsgroups. E-mail replies to
    > >> this post will be deleted without being read. Any e-mail claiming to be
    > >> from brenreyn at indigo dot ie that is not digitally signed by me with a
    > >> GlobalSign digital certificate is a forgery and should be deleted without
    > >> being read. Follow-up questions should in general be posted to the
    > >> newsgroup, but if you have a good reason to send me e-mail, you'll find
    > >> a useable e-mail address at the URL above.
    >
    >
    >


  • Next message: Victor Koch: "Re: Access VBA update recordset error"

    Relevant Pages

    • Re: Access VBA update recordset error
      ... Dim strSQL As String ... it might help to know the exact text of the error message. ... >> me to use a real e-mail address in public newsgroups. ... >> GlobalSign digital certificate is a forgery and should be deleted without ...
      (microsoft.public.data.ado)
    • Re: error messages practically worthless
      ... the .open statement) it opens fine. ... Access itself makes the query statement. ... Dim cnnFLDCW, cnnCurPrj As ADODB.Connection ... > ways to get this error message, such as typographical errors, incorrect ...
      (microsoft.public.access.externaldata)
    • Re: Return to form if query unmatched
      ... I am getting the following error message: ... If it doesn't pop up a message and set Cancel = True. ... Dim Myrst As Recordset ... Dim MyRecCount As Long ...
      (microsoft.public.access.queries)
    • Re: Script to create subdirectories
      ... I tried it and I'm getting an error message at this line: ... Dim aFolders, newFolder ... ' Splits the various components of the folder name. ...
      (microsoft.public.windows.server.scripting)
    • RE: ODBC Driver Login Failed
      ... Further coding has revealed that this error message does not occur if I do ... Dim oCnn As ADODB.Connection ... Set oCnn = New ADODB.Connection ... 'Clean up Excel Objects ...
      (microsoft.public.access.modulesdaovba)