Giving a field a value from the database

Legion

New member
Local time
Today, 08:16
Joined
Jun 4, 2004
Messages
7
I was wondering if it's possible in Access to set up a form load event that sets a value in a text box to the last value entered in a table. This way when the user closes the Database, the next time they open it, it will have the last value entered, in the box. So lets say the user enters 20 surveys... the next time they open the database, the field will populate with 20, which is stored in a table that has a row for every database. I can't use autonumber in this situation.

I tried something to the effect of, in the Form_Load event having...

surveynumber.value = bla bla bla

unfortunately I can't figure out what to put in place of bla bla bla. I tried using a recordset but all I get is errors, errors like "Database type not defined" and when I try and create a recordset it says "illegal operation". I'm used to using ASP with ADO which is pretty straight forward, so I thought I could just create a recordset object, run a query statement to build it. Jump to the last record and basically do something to the effect of...

set rs = "SELECT [Survey Number] FROM [Main Table]" <--- I know this isn't correct syntax.
rs.movelast
suverynumber.value=rs(0)

Any ideas let me know...
Thanks.

Legion
 

Users who are viewing this thread

Back
Top Bottom