Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make default value in a form be the last record entered?

Status
Not open for further replies.

BrianHamel

IS-IT--Management
Oct 31, 2002
5
0
0
US
I'm a very novice Access user and want to know how to make the default value in a form field equal the same value as the last record that was entered.

I found something called first, last function and attempted to use it as follows: =last([table name]![field name]) but it didn't work.

Any suggestions?

Thanks

Brian Hamel
bhamel@phenoxy.com
 
How are ya BrianHamel . . . . .

Hmmmmmmmmmmmmm . . . . . just what is your definition of [blue]Default Value[/blue]?

cal.gif
See Ya! . . . . . .
 
Hay BrianHamel . . . .

I hope I didn't sound condecending. If I did. . . . I aplolgize . . . .

Here's an example of doing what ya want(in your forms Current Event procedure):
Code:
[blue]Private Sub Form_Current
   If Me.NewRecord Then
      Dim rst as DAO.Recordset
      Set rst=Me.RecordsetClone
      rst.MoveLast

      Me!Field1=rst!Field1
      Me!Field2=rst!Field2
               .
               .
      Me!FieldN=rst!FieldN

      set rst=Nothing
   End If
End Sub[/blue]
Here your updating fields in a new record. Not setting default. Since its dynamic, whats the difference!

cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top