Launching edit form from data sheet (or reasonable alternative)

  • Thread starter Thread starter Michael West
  • Start date Start date
M

Michael West

What's the best or easiest way to give users the ability
to do the following:

1. To browse all records using a simple data sheet, so they can
sort on any column.

2. To then open an individual record for editing in another
form by double-clicking the row in the data sheet (or selecting
the row and then clicking an "Edit" button somewhere, etc.)

The reason I don't want to force them to update records
in data sheet view is that there are some long text fields
that don't show up in data sheet view. Is there a way to
allow user to click an "expand" arrow or "scroll" arrow in a
data sheet to allow them to read the contents of a long
text field in data-sheet view?

Thank you.
Michael West
 
Generally...you do NOT want to use a data sheet.

However, you can use a form in datasheet view..you can then go in the a
fields double click event:

docmd.OpenForm "moreDetails",,,"id = " & me.ID

The above will thus open the form.

I tend to like using continues forms..as I get better controls..here is some
screen shots that uses the above one line of code to open a detail form:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm
 
Albert said:
Generally...you do NOT want to use a data sheet.

However, you can use a form in datasheet view..you can then go in the a
fields double click event:

docmd.OpenForm "moreDetails",,,"id = " & me.ID

The above will thus open the form.

Yes, I can see that this approach will work.

Could you please give me a little more detail
about what that code is doing, especially
the part that goes
"id = " & me.ID

Many thanks.
 
I assume that your datasheet (well..actually our continues form). includes
the key id in the reocrdset of the form.

So, what we need to open a form, we use:

docmd.openForm "YourFromNameGoesHere"

Of course...if we use the above command..the form simply opens up with all
records from the whole table.

However, there is a feature of the OpenForm that allows you to pass a legal
sql "where" clause...but you DO NOT have to use the where word. So, our sql
clause would be to open to the current id that we are viewing.

"id = " & me. id

The above string will thus become something like:

"id = 1238"

So, we used:

docmd.OpenForm "detailsForm",,,"id = " & me!id

The "id = " & me!id assumes that you have a key field called "id"..but you
might in fact have used something else for the key field (so, replace "id =
" with whatever name you used for the key field.

If you looked as some of my screen shots..you can see how I placed a
"button" on the form that you an press to launch the details form (I did not
want users to have to "know" about using a double click..but the code is the
same).

The above idea of a where clause is really nice..since then you don't have
to re-write..or change the sql for a form to limit it, or open it to one
record. The same concept applies to reports...and they also have a "where"
clause. Here is some example screen shots of forms that ask the user for
some things about the report..and then the report is launched...once
again..I use the "where" clause to make this work.

http://www.attcanada.net/~kallal.msn/ridesrpt/ridesrpt.html
 
Back
Top