Click to See Complete Forum and Search --> : Cant seem to figure out where I am going wrong.


mtrack81
August 7th, 2001, 03:12 PM
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

DLARLICK
August 7th, 2001, 04:21 PM
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(?)

coolbiz
August 7th, 2001, 05:59 PM
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