CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Posts
    17

    Cant seem to figure out where I am going wrong.

    I am using access97 ok...I am basically taking a table and retrieving records that meet certain criteria and inputting those records into a form. The problem is i am successful until i get the number of records. I only get 1 out of 1 to show up when there should be many more. here's my code, please let me know where i am going wrong.

    Set rsRef = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)

    If Not rsRef.EOF() Then
    Do Until rsRef.EOF
    Me!Module_Name = rsRef!Module_Name
    Me!Lines_of_Code = rsRef!Lines_of_Code
    Me!Blank_Lines = rsRef!Blank_Lines
    Me!Comment_Lines = rsRef!Comment_Lines
    Me!Total_Lines = rsRef!Total_Lines
    Me!Category = rsRef!Category
    Me!Project_Name = rsRef!Project_Name

    rsRef.MoveNext

    Loop

    Else
    Me!Module_Name = ""
    Me!Lines_of_Code = ""
    Me!Blank_Lines = ""
    Me!Comment_Lines = ""
    Me!Total_Lines = ""
    Me!Category = ""
    Me!Project_Name = ""

    End If

    End Sub


  2. #2
    Join Date
    Jan 2000
    Location
    Pennsylvania, United States
    Posts
    106

    Re: Cant seem to figure out where I am going wrong.

    i don't have an answer just more questions.

    1. Did you try running the sql source internal to access and did you return more than one row.

    2. What is the .recordcount you have.

    3. After the check if not eof and before the loop use the .movefirst to ensure your cursor is at the beginning of the recordset.

    Let me know what you get(?)



  3. #3
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Cant seem to figure out where I am going wrong.

    Not sure how your form is setup. I assume that your form consists of textboxes and each fields is represented by a text box. Correct? If so, your form will only show the last record data as your program overwrites the previous data with each of the rsRef.MoveNext.

    You can test this by putting a MsgBox() right before rsRef.MoveNext statement and you should get the MsgBox() prompt up the same as the # of total records.

    If you're planning to allow user to scroll in between records, you'll have to implement some kind of BACK and NEXT logic. Easier way is to bound your textboxes to your RECORDSOURCE.

    Have fun,
    -Cool Bizs

    Good Luck,
    -Cool Bizs

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

Featured