string problem

Posted on 2001-06-22
Last Modified: 2010-05-02
When I want to populate a recordset with values from another like
do while not rset1.eof()
Curiosly in one computer it works fine in another one it gives an error and I must change to the following code
dim var as string
do while not rset1.eof()
Must I convert the record to a string?

Question by:asimoes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 10

Expert Comment

ID: 6217533
only thing I can think of is that you're using different ways of connecting to your data. E.g. ODBC on one machine and OLEDB on t'other...... !?
LVL 18

Expert Comment

ID: 6217623
The two pieces of code have different functionality, Var is being set outside the rset1 loop in the second example  and will then not change, in the second example rset1!name changes as you move through rset1

(I presume you are navigating through the rset1 recordset somehow, codes you posted is infinite loop isn't it?)  

Post the actual code if possible

Could rset1!name be null and rset2 does not allow a null?

Accepted Solution

Valliappan AN earned 100 total points
ID: 6217845
Try like this:

do while not rset1.eof()
  rset2!name=rset1("name").Value   'NOTE THE CHANGE in accessing property of recordset here.
  rset1.movenext  'or whatever code....

A better alternative, is to use direct SQL statements to do this like(if it suits to you), like this:

Conn.Execute "INSERT INTO table2(name) SELECT name FROM table1"

This is a faster one, I dont know, this suits you or not.

Hope this helps, Cheers.
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 10

Expert Comment

ID: 6218183
Hm...... I wonder though *why* it works..... !?

To be completely unambiguous, perhaps:

rset2.Fields("name").Value = rset1.Fields("name").Value

Expert Comment

by:Valliappan AN
ID: 6218880
I also do so. But I think it is setting as a reference,  when assigning a recordset field to another recordset field, it gives error. But not to variables, I suppose.

So, when assigning a recordset field to another recordset field, needs to assign its value.


LVL 10

Expert Comment

ID: 6218969
Yeah..... maybe.... Hm.... Anyway. Interesting :o)

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MsgBox 4 76
backup program with robocopy 6 92
Powerpoint 2013: Change cell reference in excel link 3 140
VB6 common control 6 sp6 object library not registerd 3 65
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question