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

Recordset Issues

Hi there,

does anyone know why when opening a recordset the value is on to EOF ... i want it to stay on the first record ... whenever the recordset is opened.
May 11 '07 #1
3 1560
missinglinq
3,532 Expert 2GB
If it's going to the End Of File on opening, you've probably unwittingly told it to! How are you determinig that it's going to the End Of File? Do you mean, for instance, that the record showing is the last record, alphabetically, in the record set? Is the form based on a table or a query? If based on a query, is one of the fields sorted Descending instead of Ascending?
May 11 '07 #2
hi,

here is the code i'm using.

this code is in another loop (for loop - user defined number of times) and opens works fine the first few times ... then it skips one recordset because the IF statement is true... and then is fine again ... then maybe skips a few more ... that's basically the output ... it's not giving an EOF msg on exactly the same files, ... it just works the way it wants to or something ...

do you think there is something missing?

sometimes it also misses out one or two lines from the search reults.

Expand|Select|Wrap|Line Numbers
  1. txtConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source =" & NetPath & dbfile 
  2. txtRecordset.Open "SELECT " & tab35 & ".prefix, " & tab35 & ".Indexing, " & tab35 & ".extension, " & tab36 & ".Title FROM " & tab35 & " INNER JOIN " & tab36 & " ON " & tab35 & ".Indexing = " & tab36 & ".Indexing", txtConnection, adOpenStatic, adLockOptimistic
  3.  
  4.      If txtRecordset.EOF Then
  5.     'msgbox "No Match in database, please make sure you have selected the right files..."
  6.     document.write("<BR>")
  7.     document.write ("Error Occurred While Processing the file below ... Please Process Again")
  8.     document.write("<BR>")
  9.      Else
  10.     document.write("File Number ") & i+1
  11.     document.write("<BR>")
  12.     document.write("Output Text for file ") & textfilepath 
  13.     document.write("<BR>")
  14.     Set objectwriteFile = objFSO.OpenTextFile(textfilepath, ForAppending, True)
  15.      While Not txtRecordset.EOF
  16.  
  17.     efix = txtRecordset.Fields("prefix")
  18.     xing = txtRecordset.Fields("indexing")
  19.     sion = txtRecordset.Fields("extension")
  20.     itle = txtRecordset.Fields("title")
  21.  
  22.  
  23.     document.write(efix & vbTab)
  24.     document.write(xing & vbTab)
  25.     document.write(sion & vbTab)
  26.     document.write(itle & vbTab)
  27.     document.write("<BR>")
  28.     objectwriteFile.Writeline(efix & vbTab & xing & vbTab & sion & vbTab & itle)
  29.     txtRecordset.MoveNext
  30.      Wend
  31.      End If
  32. objectwriteFile.Close
  33. txtRecordSet.Close    
  34. txtConnection.Close
  35.  
  36.  

If it's going to the End Of File on opening, you've probably unwittingly told it to! How are you determinig that it's going to the End Of File? Do you mean, for instance, that the record showing is the last record, alphabetically, in the record set? Is the form based on a table or a query? If based on a query, is one of the fields sorted Descending instead of Ascending?
May 11 '07 #3
Got the answer by trial and error, so just posting for anyone with the same issues in the future.

make sure you have the cursorlocation of the recordset before you open the recordset ... makes the database accessing 100 times faster as well as gives you the right results.

following is the sample code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Const adUseClient = 3
  3.  
  4. txtRecordset.CursorLocation = adUseClient
  5. txtRecordset.Open
  6.  
  7.  
Hi there,

does anyone know why when opening a recordset the value is on to EOF ... i want it to stay on the first record ... whenever the recordset is opened.
May 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
2
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
8
by: LabGeek | last post by:
Do I have to recreate a recordset everytime I want to use it, or can I simply create a recordset on the form open event and access it for the life of the form? I guess my question is really what...
1
by: Ed | last post by:
hi everyone, maybe someone can give me a hand here. I am working with vb 2005 and i have a gridview that i am loading data from a recordset. I have the recordset returned from the query and i am...
4
by: Joseph | last post by:
Hi all- I am a former VB6 programmer and new at C# and I have a question dealing with converting some code from VB6 to C#. The code is below and essentially, what it does is gets data from a SQL...
2
by: Tom Clavel | last post by:
Scratching my head. I am using the filter property on a combo box .AfterUpdate event to get to a single client record. This is causing a some strange behavior: As I enter a subform, I get a no...
0
by: Yarik | last post by:
Hello, Here is a sample (and very simple) code that binds an Access 2003 form to a fabricated ADO recordset: ' Create recordset... Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset '...
6
by: Harvey Triana | last post by:
Hello - I am migrating a large COM system solution to ASP.NET To transfer data from Web to client this application uses streams of ADO recordset, example: Clasic ASP (VB Script): <% Dim Rs...
4
by: phill86 | last post by:
Hi, Bare with me this is going to take some explaining and any help is much appreciated I have a form that stores details of sessions which include start/end date start/end time these...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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...

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.