Hope someone out there can help me with this.

I'm trying to write an application that will have to be using databases, although I can use Databases a little bit using Data Controls I'm stuck.

In the database there will be two colomns, say x and y.

Each record in column y will be a message, while column x will be the "Message ID". So each message will basically be numbered 1--->n.

This particular form on my application will be used to update the database with new messages. There are 2 text boxes on the form, one will have the new Message ID and the other the new Message.

When the form loads I want to open the database and move to the last record, I then want the application to take the last Message ID number i.e. the last entry in colomn x and add 1 to it and display the result in the textbox on the form corresponding to the next Message ID, this textbox has its Locked property set to True so it cannot be modified by the user.

Once the Update button is clicked the Ne Message ID and Message will be added to the database.

Here's what I have so far:

General Declaration
DIM BBDatabase As Database
DIM CMessages AS Recordset


Private Sub Form_Load()

Set BBDatabase=OpenDatabase("C:\My Documents\BB.mdb")
Set CMessages=BBDatabases.OpenRecordset("CMessages", dbOpendynaset)

CMessages.MoveLast


Don't know where to go from here though to Select the last Value of column x, the last used message ID.

Anyone with any suggestions or better ways to do complete this please reply, have a feeling using SQL may help, but I've got an SQL Bible beside me and don't even know where to start

Hope someone can help


Cheers