This is a text app I whiped up. The Button1_Click works and Button2_Click does not. You have to get the value before the connection is closed. Private m_connection As OleDb.OleDbConnection Private m_connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad( e ) m_connectionString &= HunterDev.Environment.GetUserFolderPath( SpecialFolders.Personal ) & "\db1.mdb" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If ( m_connection Is Nothing ) Then m_connection = New OleDb.OleDbConnection( m_connectionString ) End If Dim command As New OleDb.OleDbCommand( "INSERT INTO Sample ( Name ) VALUES ( '" & TextBox1.Text & "' )", m_connection ) Dim idCommand As New OleDb.OleDbCommand( "SELECT @@IDENTITY", m_connection ) If ( m_connection.State <> ConnectionState.Open ) Then m_connection.Open() End If command.ExecuteNonQuery() Dim id As Integer = CInt( idCommand.ExecuteScalar() ) If ( m_connection.State <> ConnectionState.Closed ) Then m_connection.Close() End If TextBox2.AppendText( id.ToString() & vbCrLf ) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim idCommand As New OleDb.OleDbCommand( "SELECT @@IDENTITY", m_connection ) If ( m_connection.State <> ConnectionState.Open ) Then m_connection.Open() End If Dim id As Integer = CInt( idCommand.ExecuteScalar() ) If ( m_connection.State <> ConnectionState.Closed ) Then m_connection.Close() End If TextBox2.AppendText( id.ToString() & vbCrLf ) End Sub Bo Hunter