Re: recordset abnormalities

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Jack,

A table never has a sort order -- you may have been "lucky"
in the past...

What happens if you open the recordset to a query
where you have set the order? Only then would I
expect the last record to contain 10124-00...

Or...look at your ordered query to double-check
if you have new sort problems in Vista...

good luck,

gary

"Dymondjack" wrote:

I've recently been having some issues with recordsets and their sort
order.
I am running access03 on an XP system, and everything has been working
fine
for the past three months (since I set it up for my company). At my
house,
where I do most of the developing, I upgraded from XP to Vista over the
weekend. Since I have taken a development copy home for modifications, I
have been getting strange recordset orders/results while testing on the XP
system. For example:

systblProgram is a table that gets used to temporarily store text files
that
are sorted by line. .Fields(0) = intLine and .Fields(1) = strContent

In the past, I have been able to input this data directly to the table and
later open the table directly (db.OpenRecordset("systblProgram")) and have
the records ordered by .Fields(0). This one wasn't too big of a problem,
I
just based the recordset off an ordered query rather than the table
directly.

Now, here's another issue I've found. I've got tblPrograms whose primary
key is a string based off a number (10001-00, 10002-00, 10003-00 ect...).
Now, when I run the following code, the cursor does not move to the last
record as specified, but rather the record before that. (The last record
has
a key of 10124-00, but rsPrograms.MoveLast returns 10123-00). This
particular function has ran flawlessly for the last 124 program inputs,
and
after being exposed to a Vista OS I am having trouble with it.

Has anyone experianced any sort of issues like this? Any input on this
would be a great help. Here's the core of the code for the pvtNextNumber
function

CODESTART*****
Set rsPrograms = db.OpenRecordset("tblPrograms")
blnRSProgramsOpen = True

'Check for Records
If rsPrograms.RecordCount <> 0 Then
rsPrograms.MoveLast
strLastProgram = rsPrograms.Fields(0) 'This line returns LastRec-1
strLastProgram = Mid(strLastProgram, 1, 5)
intLastProgram = CInt(strLastProgram)
intLastProgram = intLastProgram + 1
strLastProgram = Trim(Str(intLastProgram)) & "-00"
pvtstrProgram = strLastProgram
'If NoRecords
Else
pvtstrProgram = "10000-00"
End If
CODEEND*****

Any help greatly appreciated
Thanks
Jack


.



Relevant Pages

  • Re: Make Table Query - Sorting Errors
    ... Dim OutputTable As DAO.Recordset ... The query to concatenate the CAMPNO values will need to be LOOKING at the ... If you post the query you are using to do this, I beleive we can get it to ... Is there a command that I can use in the module code to first sort the ...
    (microsoft.public.access.queries)
  • Re: Make Table Query - Sorting Errors
    ... You sort in a query, ... You can do a compound sort in a query. ... "Tom Ellison" wrote: ... resulting table only has one record for each value of "CAMPNO". ...
    (microsoft.public.access.queries)
  • Re: Query doesnt always sort
    ... You have to use a query to sort the data in to your required order and then ... Access MVP 2002-2005, 2007 ... University of Maryland Baltimore County ... How do I impose a sort on the datasheet view? ...
    (microsoft.public.access.queries)
  • Re: Make Table Query - Sorting Errors
    ... MS Access MVP ... resulting table only has one record for each value of "CAMPNO". ... Is there a command that I can use in the module code to first sort the ... I have a make table query that is supposed to sort in ascending order ...
    (microsoft.public.access.queries)
  • Re: Make Table Query - Sorting Errors
    ... sorted, it will sort them as they arrive. ... you query them, why is this of any concern to you? ... correctly on the field CAMPNO. ... "Duane Hookom" wrote: ...
    (microsoft.public.access.queries)