[RESOLVED] ? Wrong recordset ? help please
I am using vb6, dbaseIII, on both (win2k sp4, and winXP SP3)
On the win2k PC the program works fine, and on the XP PC, not so much.
Problem, I am opening a recordset from .dbf file 'miheader1' but it seems that it is pulling the file named 'miheader'. The file with the '1' after is a temp file that is being added to the other. In this particular part of the program the date field of 'miheader1' is being modified. below is the code. The argument supplied is "3"
vb Code:
Private Sub CheckDate(Optional Flag As Integer = 0)
Dim FillvdateTest As Long
Dim oRS As String
StorePath = "c:\mv"
If Flag = 1 Then 'marvell
DBName = "mvheader1"
ElseIf Flag = 2 Then 'brinkley
DBName = "brheader1"
ElseIf Flag = 3 Then 'marianna
DBName = "miheader1"
Else
DBName = InputBox("Enter the name of the database (MVheader1, BRheader1, MIheader1)", "Header Name", "MVheader1")
End If
Text1.Text = Text1.Text & "*****************************" & vbCrLf
Text1.Text = Text1.Text & "*****************************" & vbCrLf
Text1.Text = Text1.Text & "*******" & DBName & "**********" & vbCrLf
Text1.Text = Text1.Text & "*****************************" & vbCrLf
Text1.Text = Text1.Text & "*****************************" & vbCrLf
Text1.Text = Text1.Text & "opening connection to db" & vbCrLf
Call OpenConnection
Text1.Text = Text1.Text & "connection open" & vbCrLf
If RS.State <> 0 Then
RS.Close
End If
Text1.Text = Text1.Text & "opening Recordset " & vbCrLf
oRS = "select hdr_date from " & DBName & " order by hdr_date asc"
Text1.Text = Text1.Text & oRS & vbCrLf
Text1.Text = Text1.Text & "rs state = " & RS.State & vbCrLf
RS.Open oRS, CN, adOpenDynamic, adLockOptimistic
Text1.Text = Text1.Text & "rs state = " & RS.State & vbCrLf
Text1.Text = Text1.Text & "recordset was opened successfully" & vbCrLf
RS.MoveFirst
FillvdateTest = RS.Fields(0).Value
Text1.Text = Text1.Text & RS.Fields(0).Value
Text1.Text = Text1.Text & "Test statement" & vbCrLf & " ~>If FillvdateTest(" & FillvdateTest & ") < 19999999 Then"
If FillvdateTest < 19999999 Then
Call FillVDate(Flag)
End If
End Sub
Note the text1.text statements below is the log
wrapped in code tags just to section off
Code:
*****************************
*****************************
*******miheader1**********
*****************************
*****************************
opening connection to db
connection open
opening Recordset
select hdr_date from miheader1 order by hdr_date asc
rs state = 0
rs state = 1
recordset was opened successfully
20060130Test statement
~>If FillvdateTest(20060130) < 19999999 Then
Fillvdate should = 75723
which is the first date field in 'miheader1'
20060130 is the first date field in 'miheader'
Is there a length limit on dbase names?? remember that it works on the Win2K PC.
Thanks for any pointers. I know the code is sloppy *sorry
-RT
Re: ? Wrong recordset ? help please
the length of the file name made the difference. While I have not experienced tis problem using the same program on a different OS. There might be a work around or an update to a file but I didn't have time to research so I rewrote a little bit of code and changed the name of the temp dbase file.
I'm marking this thread as resolved. If anyone does know of the right fix, that is what file (.dll) whatever has to be updated that info would be most welcomed.
Thanks all
-RT