473,396 Members | 1,843 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,396 software developers and data experts.

Recordset operation seems to hang

Hi everyone.

I'm doing some updating from one recordset to another and the
operation seems to get part way through and then seems to hang (as if
it was a bad loop) but then comes alive again with the operations
successfully completed.

Perhaps its the way the information is cached?

Both tables are linked: the target table is in MSDE (SQL) and the
source is a text file. Its not gonna be efficient (i know) but will
be a tool to help me achieve another task ;)

I've included my code below if anyone is interested in having a look.

Thanks,
Mark

Option Compare Database

Private Sub Import(strSource As String, strTarget As String,
strMappings As String)

Dim wrkDefault As Workspace
Dim dbsSIMMS As Database
Dim rstSource As Recordset
Dim rstTarget As Recordset
Dim rstMappings As Recordset

Dim strCriteria As String

Set dbsSIMMS = OpenDatabase(Application.CurrentDb.name)
Set rstSource = dbsSIMMS.OpenRecordset(strSource, dbOpenDynaset)
Set rstTarget = dbsSIMMS.OpenRecordset(strTarget, dbOpenDynaset)
Set rstMappings = dbsSIMMS.OpenRecordset(strMappings,
dbOpenDynaset)

While Not rstSource.EOF

strCriteria = ""
rstMappings.MoveFirst
While Not rstMappings.EOF
If rstMappings("PrimaryKey") = True Then
If strCriteria <> "" Then
strCriteria = strCriteria & " AND "
End If
strCriteria = strCriteria & rstMappings("TargetField")
& " = '" & _
rstSource(rstMappings("SourceField")) & "'"
End If
rstMappings.MoveNext
Wend

rstTarget.FindFirst strCriteria
If rstTarget.NoMatch Then
rstTarget.AddNew
Else
rstTarget.Edit
End If

rstMappings.MoveFirst
While Not rstMappings.EOF
rstTarget(rstMappings("TargetField")) =
rstSource(rstMappings("SourceField"))
rstMappings.MoveNext
Wend

rstTarget.Update
rstSource.MoveNext

Wend

rstSource.Close
rstTarget.Close
rstMappings.Close
dbsSIMMS.Close

End Sub

Private Sub cmdProceed_Click()
Import "students", "dbo_students", "mappings"
End Sub
Nov 13 '05 #1
0 1109

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

Similar topics

8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
5
by: !TG | last post by:
I currently use Do while loop, but I'd rather use a For Loop though I have never gotten the hang of them. Would some one please be so kind as to show me how to loop through a recordset.
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
14
by: Karl Irvin | last post by:
While adding data to a record set, I use something like rst! = some variable rst! = some variable ...... rst! = some variable The rst! , rst! etc. are manually typed in and it gets...
1
by: vinodkus | last post by:
vinod...@gmail.com wrote: Please stop shouting. Total records?? I think (hope) you mean "count of the total records". In
5
by: downwitch | last post by:
I have the strangest error, and wonder if anyone else has seen it. I'm using ADODB to return a set of SQL Server 2005 records via ODBC. If I open the recordset this way With cmd .CommandType =...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
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: 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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.