Re: Update a table using a form
- From: John Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 10:53:28 -0700
On Wed, 30 Nov 2005 06:27:02 -0800, "WGordon"
<WGordon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>This may be a hopeless case. I have the form set up to modify a field in a
>table (not enter a new record). I use the Auto Number as a reference to find
>the record I want to modify (usually the last record). When the form opens it
>always starts at the first record (#1). If I enter data into the form it
>modifies record #1. What I need to do is modify the last existing record in
>the table. This form is accessed thru a Main Menu I have set up. When I enter
>the code you suggested in the Open field it causes a "Compile Error:
>Ambigious name detected" and refers to another form. I tried changing the
>code to "DoCmd.GoToRecord acLastRecord" but this didn't help.
>I know how difficult it is to trouble shoot something you can't get your
>hands on. Thanks for the help.
Not at all hopeless - just need to figure out what the real problem
is!
Open the Form in design view.
View its Properties.
On the Events tab find the Open event.
Click the ... icon by it.
Choose Code Builder. Access will open a VBA editor window with the Sub
and End Sub lines below. Edit it to:
Private Sub Form_Open(Cancel as Integer)
DoCmd.GoToRecord acLast
End Sub
Two questions:
- How can you be sure that the LAST record is the correct one to edit?
- How are you opening the form? Might it better be based on a Query
which returns only the desired record, so the problem of navigating
doesn't arise?
John W. Vinson[MVP]
.
- Prev by Date: Re: Form's underlying table name changes
- Next by Date: Re: Limit To List
- Previous by thread: Re: Form's underlying table name changes
- Next by thread: Re: Update a table using a form
- Index(es):
Relevant Pages
|