assigning values to lines in form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which is supposed to have one or more lines.I use VB code to
populate the form. I use a SQL string to get my rows and assign the results
to a recordset. I am supposed to write out a line for each row from my
recordset. I have a loop to assign to the form controls the values from each
row from the recordset. However, my form only shows one line and it contains
the last row from my recordset.
I am new to VB and access and I am looking for a code that will create
another detail line when I have a movenext in my loop of the recordset.
Thanks for any help or leads.
Martin
 
What kind of control on the form are you using to display the rows?
Normally you use a query to populate a form or a control.
You don't have to build the recordset manually unless the selection criteria
is very complex.

Dorian
 
I have textboxes to display the fields in the rows in my recordset. I
initially have a query, so I did not have to code the setting of values for
my controls. Unfortunately, my query is a little complicated ( multiple joins
of tables and queries) that makes the form not updatable. I am now trying to
hard code the functionalities of the form, the assigning of values, the
updates and the like. I assign the result of my SQL code to a recordset and
loop through the setting of values to the controls. The problem now is the
form shows only one line and that contains the last row of the recordset.
My code looks like this:

Do While Not rstAdjustments.EOF
Me!txtConsumer = rstAdjustments!Consumer
Me!txtAdjustment = rstAdjustments!Adjustment
Me!txtReason = rstAdjustments!Reason
rstAdjustments.MoveNext
Loop


I do not know what form method to use to force it to write the line to the
form before it gets overlaid by the next row from the record set.

Thanks for your help!
 
Back
Top