Re: Access VBA update recordset error
From: cityofgp (cityofgp_at_discussions.microsoft.com)
Date: 10/29/04
- Previous message: Jiho Han: "Re: MDAC 2.8 vs MDAC 2.7"
- In reply to: Brendan Reynolds: "Re: Access VBA update recordset error"
- Next in thread: Victor Koch: "Re: Access VBA update recordset error"
- Reply: Victor Koch: "Re: Access VBA update recordset error"
- Messages sorted by: [ date ] [ thread ]
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.
>
>
>
- Previous message: Jiho Han: "Re: MDAC 2.8 vs MDAC 2.7"
- In reply to: Brendan Reynolds: "Re: Access VBA update recordset error"
- Next in thread: Victor Koch: "Re: Access VBA update recordset error"
- Reply: Victor Koch: "Re: Access VBA update recordset error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|