Re: Access VBA update recordset error

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


Date: Fri, 29 Oct 2004 07:44:04 -0700

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.



Relevant Pages

  • Re: Convert Access 2 to Access 2000
    ... Decl statements that reference DLL's will need to be re-written. ... > "Brendan Reynolds" wrote in message ... >> GlobalSign digital certificate is a forgery and should be deleted without ... >>>> Dim ThisPlayer As Long ...
    (microsoft.public.access.conversion)
  • Re: How can I get Atributes from the field of the table via VBA
    ... I think is data type in code ... "Brendan Reynolds" wrote: ... I don't know how you could get the caption and format, ... Dim tdf As DAO.TableDef ...
    (microsoft.public.access.adp.sqlserver)
  • Re: default constraint
    ... GlobalSign digital certificate is a forgery and should be deleted without ... Dim cnn As ADODB.Connection ... >> The spammers and script-kiddies have succeeded in making it impossible ... >> me to use a real e-mail address in public newsgroups. ...
    (microsoft.public.access.modulesdaovba)
  • Re: default constraint
    ... GlobalSign digital certificate is a forgery and should be deleted without ... Dim cnn As ADODB.Connection ... >> The spammers and script-kiddies have succeeded in making it impossible ... >> me to use a real e-mail address in public newsgroups. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: default constraint
    ... GlobalSign digital certificate is a forgery and should be deleted without ... Dim cnn As ADODB.Connection ... >> The spammers and script-kiddies have succeeded in making it impossible ... >> me to use a real e-mail address in public newsgroups. ...
    (microsoft.public.vb.general.discussion)