RowSource Property?

M

Mike Collard

Hi

I have a form that is populated by the user making a
selection from a combo box with the RowSource based on a
query. Once the record is retrieved the user can make
changes to data and save any changes to a table. It is not
a straightforward data entry form, the controls are filled
by a stored procedure and when a Confirm button is clicked
another procedure runs to make some calculations which are
subsequently saved.

Occasionally it is necessary to update all records so I
need some code that retrieves each record in turn from the
combo box and then runs the Confirm click event.

How can I do this? Maybe a Do...Loop that can select from
the combo box?

Many thanks for any assistance.

Mike Collard
 
S

Synergy

Hello Mike,

I am guessing that you want to update each record on the form. The
procedure would be like this:

Dim rst as Recordset
Set rst = Me.RecordSetClone

rst.MoveFirst
Do Until rst.EOF
Call myButton_Click
rst.MoveNest
loop

Set rst = Nothing


Substitute the Click event procedure of your button for myButton_Click.


God Bless,

Mark A. Sam
 
M

Mike Collard

Hi Mark

Looks good - thanks.

Mike
-----Original Message-----
Hello Mike,

I am guessing that you want to update each record on the form. The
procedure would be like this:

Dim rst as Recordset
Set rst = Me.RecordSetClone

rst.MoveFirst
Do Until rst.EOF
Call myButton_Click
rst.MoveNest
loop

Set rst = Nothing


Substitute the Click event procedure of your button for myButton_Click.


God Bless,

Mark A. Sam




.
 
D

Dirk Goldgar

Mike Collard said:
Hi Mark

Looks good - thanks.

Mike

I don't think that will work as written, since moving in the
recordsetclone doesn't in itself change the form's current record. If
you're using Access 2000 or later, change

to

Set rst = Me.Recordset

and incidentally correct

to

rst.MoveNext

If you're using Access 97, leave the "Set rst" statement as Mark posted
it, but insert a line after the "Do Until" statement:

Do Until rst.EOF
Me.Bookmark = rst.Bookmark
' ...
 
S

Synergy

Thank Dirk,

I just thought about setting the bookmark and was going to add that
correection.


Mark
 

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