473,378 Members | 1,426 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,378 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 2691
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.