Re: recordset abnormalities
- From: "Gary Walter" <gary@xxxxxxxxxxx>
- Date: Thu, 6 Dec 2007 07:23:59 -0600
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
.
- References:
- recordset abnormalities
- From: Dymondjack
- recordset abnormalities
- Prev by Date: Re: Message Alert
- Next by Date: Re: Date an Object was last modified - A2k3
- Previous by thread: recordset abnormalities
- Next by thread: RE: Directories, folders, and files
- Index(es):
Relevant Pages
|