Recordset with Leep

G

Guest

Hi everybody
I have following recordset on a form,after update of SupID field. What I
want is to bring all the records for the supplier, more than one record, but
on my form it is comming only one record, any idea? My idea is to bring
records than i will edit the records and save the same. my recordset is as
follows:
Set rst = db.OpenRecordset("SELECT * FROM tPrices WHERE SupID =" & SupID &
";")
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
Me.WasteCode = rst!WasteCode
Me.WastePrice = rst!WastePrice
rst.MoveNext
Loop
rst.Close
Set db = Nothing

Thank & Regards
Wahab
 
J

John Vinson

Hi everybody
I have following recordset on a form,after update of SupID field. What I
want is to bring all the records for the supplier, more than one record, but
on my form it is comming only one record, any idea? My idea is to bring
records than i will edit the records and save the same. my recordset is as
follows:
Set rst = db.OpenRecordset("SELECT * FROM tPrices WHERE SupID =" & SupID &
";")
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
Me.WasteCode = rst!WasteCode
Me.WastePrice = rst!WastePrice
rst.MoveNext
Loop
rst.Close
Set db = Nothing

Thank & Regards
Wahab

Eh? If the Recordset returns 100 records, this code will write
WasteCode and WastePrice from the first record into the form,
instantly overwrite it with the values from the second record, then
the third, then on to the hundredth.

I would suggest using a Continuous Form (or Subform) and simply
setting its Recordsource property to the SQL string; or, if you use a
Subform, don't use any code AT ALL, just use SupID as the Master and
Child Link Field. Or, if you're trying to update data in a Table,
don't use the *FORM* at all - just run an Update Query.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
G

Guest

Thanks John
I use only continus form, still Im getting 1 record only. For some reason I
dont want to use form - subform. I my form I have 1 combo to select supplier
and after update of SupID I wrote the recordset.
any better advice?
Wahab
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top