473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Trouble changing value in an appended field in ADO recordset

Greetings,

I have searched hi and lo through the groups and haven't found my
problem specifically. I have listed below what I have tried based on
what I have found in the groups. Please let me know if what I am
trying to do is even possible; if it is, any insight is greatly
appreciated.

I am building an ADO recordset from an SQL server, connection
properties as follows (coding in VBA/A2K):

conn.Provider = "MSDataShape.1"
conn.Properties("Data Source").Value = "Server"
conn.Properties("Initial Catalog").Value = "Database"
conn.Properties("Password").Value = "pw"
conn.Properties("User ID").Value = "id"
conn.Properties("Data Provider").Value = "SQLOLEDB.1"
conn.Properties("Persist Security Info").Value = True

SQL="Select field1, field2, "MadeUpField" as field3 From tblFields"

rst.Open SQL, conn, adOpenDynamic, adLockPessimistic

The recordset will be set to a form's recordset in A2K. The values for
field3 come from another entire data source, so I am trying to fill in
the values for field3 dynamically by moving through the recordset,
before binding the recordset to the form.

I have tried to modify the field3 value in the recordset resulting from
using the SQL above as follows:

Do Until rst.EOF
rst.Fields("field3").Value = strSomeValue
rst.Update
rst.MoveNext
Loop

This gives the 'Multi-step operation generated errors. Check each
status value.' error when it gets to the
rst.Fields("field3").Value = strSomeValue line of code.

I have also tried using this SQL:
SQL="Select field1, field2, From tblField" (not including the added
field)

and this code to append the field to the recordset:

rst.Fields.Append "field3", adChar, 50
rst.CursorLocation = adUseClient
rst.Open SQL, conn(same as above), adOpenDynamic, adLockPessimistic
rst.MoveFirst
Do Until rst.EOF
rst.Fields("field3").Value = strFieldValue
rst.Update
rst.MoveNext
Loop

This code give me 'Item cannot be found in the collection corresponding
to the requested name or ordinal when it gets to the
rst.Fields("field3").Value = strSomeValue line of code.

I am dying here, any help is greatly appreciated!

rn

Nov 13 '05 #1
3 2697
Sien..
Could you restate your problem in a sentence?

Nov 13 '05 #2
In the SQL statement "Select field1, field2, "MadeUpField" as field3
From tblFields", I need to programatically change the value of field3,

which is populated with the value "MadeUpField" on every row. In other
words, the column is not from the actual data source, it is appened via
the SQL statement. I have been unable to programmatically move through
the rows of the recordset and change the values of that field using
either of the methods described above. I hope this clarifies some...
thanks

Nov 13 '05 #3
And here is the answer:

http://support.microsoft.com/kb/223771/

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alistair | last post by:
Hi there, New to PHP. I have always used ASP. I am having trouble trying to do the things in PHP the way (or similar) i did it in ASP. In ASP I used an Access database. I now use a mySQL...
9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
3
by: William Wisnieski | last post by:
Hello Again, I'm really stuck on this one.....so I'm going to try a different approach to this problem. I have a query by form that returns a record set in a datasheet. The user double...
0
by: sienayr | last post by:
Greetings, I have searched hi and lo through the groups and haven't found my problem specifically. I have listed below what I have tried based on what I have found in the groups. Please let me...
1
by: mplus_2000 | last post by:
I have recently inherited a database. The switchboard (and other forms) displays the name of the database on it (top, center). Currently the name that appears is Reviews. There are plans to roll...
59
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
3
by: Janelle.Dunlap | last post by:
I have an Excel spreadsheet containing a column of hyperlinks that I need to import into Access. I have no trouble importing (in my case actually linking) the spreadhsheet to the Access table,...
0
by: Bomac8 | last post by:
I have a text file with a four field array like this: DET-01-002737,DET-01-002737,YES,64239764b32fefc915a593f41bdb5730. My program sorts them in the order where the 3rd field says "Yes" or "NO". ...
1
by: omar.norton | last post by:
I am trying to create a from with a series of combo boxes that each query a different field (called Specific01, Specific02 etc., except the first field which is called Condition). Each combo box...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.