Results 1 to 2 of 2

Thread: [RESOLVED] ? Wrong recordset ? help please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Location
    In the midst of corn, cotton, and beans
    Posts
    185

    Resolved [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:
    1. Private Sub CheckDate(Optional Flag As Integer = 0)
    2.     Dim FillvdateTest As Long
    3.     Dim oRS As String
    4.     StorePath = "c:\mv"
    5.     If Flag = 1 Then 'marvell
    6.         DBName = "mvheader1"
    7.     ElseIf Flag = 2 Then 'brinkley
    8.         DBName = "brheader1"
    9.     ElseIf Flag = 3 Then 'marianna
    10.         DBName = "miheader1"
    11.     Else
    12.         DBName = InputBox("Enter the name of the database (MVheader1, BRheader1, MIheader1)", "Header Name", "MVheader1")
    13.     End If
    14.     Text1.Text = Text1.Text & "*****************************" & vbCrLf
    15.     Text1.Text = Text1.Text & "*****************************" & vbCrLf
    16.     Text1.Text = Text1.Text & "*******" & DBName & "**********" & vbCrLf
    17.     Text1.Text = Text1.Text & "*****************************" & vbCrLf
    18.     Text1.Text = Text1.Text & "*****************************" & vbCrLf
    19.     Text1.Text = Text1.Text & "opening connection to db" & vbCrLf
    20.     Call OpenConnection
    21.     Text1.Text = Text1.Text & "connection open" & vbCrLf
    22.     If RS.State <> 0 Then
    23.         RS.Close
    24.     End If
    25.     Text1.Text = Text1.Text & "opening Recordset " & vbCrLf
    26.     oRS = "select hdr_date from " & DBName & " order by hdr_date asc"
    27.     Text1.Text = Text1.Text & oRS & vbCrLf
    28.     Text1.Text = Text1.Text & "rs state = " & RS.State & vbCrLf
    29.     RS.Open oRS, CN, adOpenDynamic, adLockOptimistic
    30.     Text1.Text = Text1.Text & "rs state = " & RS.State & vbCrLf
    31.     Text1.Text = Text1.Text & "recordset was opened successfully" & vbCrLf
    32.     RS.MoveFirst
    33.     FillvdateTest = RS.Fields(0).Value
    34.     Text1.Text = Text1.Text & RS.Fields(0).Value
    35.     Text1.Text = Text1.Text & "Test statement" & vbCrLf & "   ~>If FillvdateTest(" & FillvdateTest & ") < 19999999 Then"
    36.     If FillvdateTest < 19999999 Then
    37.         Call FillVDate(Flag)
    38.     End If
    39. 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

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2006
    Location
    In the midst of corn, cotton, and beans
    Posts
    185

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width