I am having a problem geting data from my tables in Access 2000.
I am using the rs.getstring() which returns all rows which is fine. After playing abit I started to use rs.getstring(,data.rsRADetail.AbsolutePosition,"|")
which returned the first line but then when I called this again to get the second row, I got 2nd and 3rd row and called it again and got 4th and 5th ??? why does this happen ? why did I not get the 1st and 2nd the first time a Called this command ?
I have called debug.print data.rsRADetail.AbsolutePosition and it shows 1 then 2 then 4. Can any one help me ??
I can post my code if needed.
02-07-2007, 11:09 AM
What is the value of data.rsRADetail.AbsolutePosition when you call GetString the first and second time? What is the row delimiter?
02-07-2007, 12:26 PM
When calling debug.print data.rsRADetail.AbsolutePosition for the first time it returns 1 (I have code before I call Getstring to make sure I am at 1st record) when called again it returns 2 BUT string value = Rows 2 & 3 call Getstring again debug.print ..... returns 4.
I have tried Rowdelimiter as "*|" but still returns 2 rows and when running the rest of code to 'strip' the string it goes from the last row delimiter, so returns records 3 and 5 missing 2 & 4 ????
Sorry for the messy code but I am still learning.
Public RARating, RAScore, RALike, RAControl,RAWorst,RAHazard as String
Public Sub GetDataString(AssessName)
Dim DataStop as Long
Dim DataString as String
Dim Variable as String
Select Case AssessName
If anyone can tell me of an easier way to do this that will be good !
Hope this helps, I can and willing to email Project to any one to have a look at.
Thanks for help
02-07-2007, 12:47 PM
NumRows Optional. The number of rows to be converted in the Recordset. If NumRows is not specified, or if it is greater than the total number of rows in the Recordset, then all the rows in the Recordset are converted.
As you see by the above clip from the GetString() documentation, that this parameter is the number of rows to return, so the first time AbsolutePosition was on record 1 so it returned 1 record, the next time AbsolutePosition would be 2 so you got 2 records, the next time AbsolutePosition would be 4 so you would get 4 records, etc...
The AbsolutePosition returns your position within the list of records; but the parameter you passed it to was looking for how many records you wanted to retreive.
If you want to process only one record at a time you should simply pass the value of 1 each time you call GetString(). Then you can use AbsolutePosition to see where you are and you can use EOF, or compare AbsolutePosition with RecordCount, to see when you reach the end.
02-07-2007, 01:05 PM
I think Ron explained your results. What I'm wondering is why you are using GetString instead of:
GetString is really only useful for applying formatting to a Recordset as a whole, typically for display.
02-08-2007, 06:44 AM
Thanks Ron I thought RowNums was the row number to return not how may rows !!
Paul - I had asked someone else on the net and they said use getstring() as it is really easy, I had started by doing it the way you have said but he was tell this was the best way.
One thing I didn't say in my first post was once I have retrived the data I am then going to put it in a word document as the 'child' information which is the next bit I am stuck on.
If I may ask this question as well, I have some code which write to word fine when it is the 'Parent' Information, but when I come to put the 'Child' info in it is a bit harder. The word document has been designed by someone else and then given to me to fill in the blanks, as it were.
The Child info is split into 6 columns and I need to put the above data in to these columns.. Can any one throw some light on this one please