Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: newbie - edit record from access 97 listview


Message #1 by "paul leech" <paul.leech@f...> on Wed, 24 Apr 2002 11:52:29
Firstly thanks in advance for any info given.  I'm wondering if I can edit 
a record in Access 97 by double clicking on a listview and calling up an 
edit form.  Is this possible? and if so how?  

cheers Paul
Message #2 by Richard Gibson <rgibson@W...> on Wed, 24 Apr 2002 11:55:23 +0100
You have a table with lots of records in it and you want to be able to
select one from a list then edit it?

Dead easy.

Create a form based on the table (use the form wizard).

When you've done that you can scroll through the records and edit them but
it might take some time to find the relevant one.

Now go into design view, make a bit of space in the form header and use the
wizard to add a combo box.  When you put it on the form the wizard starts up
and you can tell it what you want it to do.


You should end up with a field on the form where you can choose the record
and the details will appear on the form.

If you need further info let me know.




Regards

Richard Gibson
IT Manager


The information in this message is confidential and intended for the
addressee only.  If you have received this message in error please delete
and notify the sender, any other action may be unlawful.

The views expressed in this message are personal and not necessarily those
of Walkerpack Ltd unless explicitly stated.


-----Original Message-----
From: paul leech [mailto:paul.leech@f...]
Sent: 24 April 2002 12:52
To: Access
Subject: [access] newbie - edit record from access 97 listview


Firstly thanks in advance for any info given.  I'm wondering if I can edit 
a record in Access 97 by double clicking on a listview and calling up an 
edit form.  Is this possible? and if so how?  

cheers Paul
Message #3 by "paul leech" <paul.leech@f...> on Wed, 24 Apr 2002 13:08:15
Cheers Richard - but what I want to have is a listview populated from a 
table (done that) - and now what I want to be able to do is, select a 
record by dblclick  and have the selected record open in another form for 
editing.

cheers Paul

> You have a table with lots of records in it and you want to be able to
select one from a list then edit it?

Dead easy.

Create a form based on the table (use the form wizard).

When you've done that you can scroll through the records and edit them but
it might take some time to find the relevant one.

Now go into design view, make a bit of space in the form header and use the
wizard to add a combo box.  When you put it on the form the wizard starts 
up
and you can tell it what you want it to do.


You should end up with a field on the form where you can choose the record
and the details will appear on the form.

If you need further info let me know.




Regards

Richard Gibson
IT Manager


The information in this message is confidential and intended for the
addressee only.  If you have received this message in error please delete
and notify the sender, any other action may be unlawful.

The views expressed in this message are personal and not necessarily those
of Walkerpack Ltd unless explicitly stated.


-----Original Message-----
From: paul leech [mailto:paul.leech@f...]
Sent: 24 April 2002 12:52
To: Access
Subject: [access] newbie - edit record from access 97 listview


Firstly thanks in advance for any info given.  I'm wondering if I can edit 
a record in Access 97 by double clicking on a listview and calling up an 
edit form.  Is this possible? and if so how?  

cheers Paul
Message #4 by Richard Gibson <rgibson@W...> on Wed, 24 Apr 2002 13:57:12 +0100
Sorry Paul, 

not that much of a newbie.

I'm doing something similar all over the place in our main company database.
I use recordsets to do it  (I'm using Access 2000 and ADO but you can do the
same in DAO).

I have a form which is linked to the relevant table so it shows all records.
I can scroll up and down etc to view the info.  If I want to change one of
the records I can double click on the relevant row and have another form
open which allows me to edit that record.  I tend to use it to print
documents more than to change data but the principle is the same).

You must have the primary key on the form (either visible or hidden).  I
attach code to the double click event of one of the fields on the form then
have the following code run:

Create a recordset based on a select statement (based on the underlying
table but only including the relevant record

in ADO this is 
dim rst as adodb.recordset
set rst = new adodb.recordset
rst.open "select * from tbltablename where primarykey =" &
forms!frmoriginalform.primarkeyfield, etc

I then open a new unbound form and use the recordset to populate the fields

with rst

forms!frmnew.txtfield1 = !field1
etc.

.close
end with
set rst = nothing


You now have a second form open which displays the data for the one record.

Make any changes to the data on the form without affecting the underlying
table until you are sure that you want to

To write the changes back to the table you put an "update" button on the
form which reverses what you did earlier in the code:

dim rst etc
etc
etc

with rst
!field1 = me!txtfield1
etc
.update 

.close
end with
set rst = nothing



or a "cancel" button which just closes the form without writing any changes.


Hope this is more helpful,




Regards

Richard Gibson
IT Manager


The information in this message is confidential and intended for the
addressee only.  If you have received this message in error please delete
and notify the sender, any other action may be unlawful.

The views expressed in this message are personal and not necessarily those
of Walkerpack Ltd unless explicitly stated.


-----Original Message-----
From: paul leech [mailto:paul.leech@f...]
Sent: 24 April 2002 14:08
To: Access
Subject: [access] RE: newbie - edit record from access 97 listview


Cheers Richard - but what I want to have is a listview populated from a 
table (done that) - and now what I want to be able to do is, select a 
record by dblclick  and have the selected record open in another form for 
editing.

cheers Paul

> You have a table with lots of records in it and you want to be able to
select one from a list then edit it?

Dead easy.

Create a form based on the table (use the form wizard).

When you've done that you can scroll through the records and edit them but
it might take some time to find the relevant one.

Now go into design view, make a bit of space in the form header and use the
wizard to add a combo box.  When you put it on the form the wizard starts 
up
and you can tell it what you want it to do.


You should end up with a field on the form where you can choose the record
and the details will appear on the form.

If you need further info let me know.




Regards

Richard Gibson
IT Manager


The information in this message is confidential and intended for the
addressee only.  If you have received this message in error please delete
and notify the sender, any other action may be unlawful.

The views expressed in this message are personal and not necessarily those
of Walkerpack Ltd unless explicitly stated.


-----Original Message-----
From: paul leech [mailto:paul.leech@f...]
Sent: 24 April 2002 12:52
To: Access
Subject: [access] newbie - edit record from access 97 listview


Firstly thanks in advance for any info given.  I'm wondering if I can edit 
a record in Access 97 by double clicking on a listview and calling up an 
edit form.  Is this possible? and if so how?  

cheers Paul
Message #5 by "paul leech" <paul.leech@f...> on Wed, 24 Apr 2002 14:49:01
Cheers Richard - will give it a lash and let u know.

Thanks Paul

  Return to Index