Re: Access VBA update recordset error
From: Brendan Reynolds (brenreyn)
Date: 10/28/04
- Next message: cityofgp: "Re: Access VBA update recordset error"
- Previous message: Stan the Mouse: "How to Write into Excel"
- In reply to: cityofgp: "Access VBA update recordset error"
- Next in thread: cityofgp: "Re: Access VBA update recordset error"
- Reply: cityofgp: "Re: Access VBA update recordset error"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 28 Oct 2004 18:00:26 +0100
I don't see anything obviously wrong with the example you posted, and the
test code below works for me. I prefer something like rst.Fields("Field
Name") myself, as it is a little more explicit, but ![Field Name] should
work, too. What error are you seeing?
Public Sub TestUpdate()
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open "SELECT * FROM tblTest"
.AddNew
![Field Name With Spaces] = "Some Text"
.Update
.Close
End With
End Sub
-- 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:FB8B3D87-5187-44A8-A150-4609ED660939@microsoft.com... > Using ADODB.recordset and connection, I can successfully update records > using: > > rs![field1] = "blah" > rs.update > > However, when I have a field name with a space as follows: > > rs![field 1] = "blah" > rs.update > > I get a syntax error message. > How can I update fields that have spaces in the field name? What syntax do > I > use? > > TIA. >
- Next message: cityofgp: "Re: Access VBA update recordset error"
- Previous message: Stan the Mouse: "How to Write into Excel"
- In reply to: cityofgp: "Access VBA update recordset error"
- Next in thread: cityofgp: "Re: Access VBA update recordset error"
- Reply: cityofgp: "Re: Access VBA update recordset error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|