Form to update table and detect changes

D

Damon Grieves

I have a table in A2k3 that is a current list of pieces of equipment. And I
need a form so that the user can change and update the list of equipment.
When a change is made a copy is appended to the history table so a current
equipment record which can be selected and linked to a service in the
service table relating to that particular piece of equipment.
My problem is that the number of current pieces of equipment may change. So
a form allowing the user to modify the current table can't (easily) be
created with fields that can be checked for change on update etc. It can be
created with a datasheet subform but this doesn't allow the control to
detect changes. The user may not just be adding new equipment records but
changing location etc Maybe I can create a number of rows of fields and
count the number of records and make that number of rows of fields on the
form visible. Is there a simple way of doing this I'm missing?
TIA
 
G

Guest

I would suggest you use a read only datasheet view if you want to be able to
view multiple records. The use a regular form to do the editing. That way
you will be able to know what fields have changed.

Just put a command button on you form with the datasheet view as a subform
that opens the edit form with the current record of the datasheet subform.
 
D

Damon Grieves

Thanks Dave
How would I know which record was selected to edit from the datasheet?
 
G

Guest

Which ever record the cursor is one in datasheet view is the current record.
Assume the txtCustNo control is bound to the unique field of the form's
record source. Then Me.txtCustNo will return the CustNo of the record where
the cursor is.

So with a command button on the parent form, you could use txtCustNo in the
Where argument of the OpenForm method to open the edit form with that record
displayed.
--
Dave Hargis, Microsoft Access MVP


Damon Grieves said:
Thanks Dave
How would I know which record was selected to edit from the datasheet?
 
D

Damon Grieves

Fantastic!
Thanks Dave

Klatuu said:
Which ever record the cursor is one in datasheet view is the current record.
Assume the txtCustNo control is bound to the unique field of the form's
record source. Then Me.txtCustNo will return the CustNo of the record where
the cursor is.

So with a command button on the parent form, you could use txtCustNo in the
Where argument of the OpenForm method to open the edit form with that record
displayed.
 

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