CopyFromRecordset Not Working Hi I Inserted A Select MaxID+1 Data and want to retrieve what was that ID I inserted the Following is the codes

Im trying to Insert data from Excel to Ms Access and Automatically Retrieve that Data.
For MultiUser Purpose I need to retrieve specifically the data I inserted.

Sub PostData()
Dim cnn As ADODB.Connection 'dim the ADO collection class
Dim rst As ADODB.Recordset 'dim the ADO recordset classe here
Dim dbPath
Dim x As Long, i As Long

'add error handling
On Error GoTo errHandler:

dbPath = Sheets("Sheet3").Range("h1").Value

Set cnn = New ADODB.Connection

cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &amp; dbPath

Set rst = New ADODB.Recordset 'assign memory to the recordset
Sql = "INSERT INTO DvID(DVnumber)SELECT Max(DVNumber)+1 FROM DvID "
rst.Open Sql, cnn
Sheet3.Range("A2").CopyFromRecordset rst
rst.Close
cnn.Close

Set rst = Nothing
Set cnn = Nothing

On Error GoTo 0
Exit Sub
errHandler:

Set rst = Nothing
Set cnn = Nothing

MsgBox "Error " &amp; Err.Number &amp; " (" &amp; Err.Description &amp; ") in procedure Export_Data"
End Sub
I finally Figure it out.
Do
On Error Resume Next 'reset Err.obj.

 'Get the Max ID +1
Set rst = Nothing
Set rst = New ADODB.Recordset 'assign memory to the recordset
SQL = &quot;SELECT Max(ApNumber)+1 FROM PayVoucherID &quot;
rst.Open SQL, cnn

'Check if the recordset is empty.
'Copy Recordset to the Temporary Cell
Sheets(&quot;MAX&quot;).Range(&quot;A2&quot;).CopyFromRecordset rst

'Insert the Data to Database And Check If no Errors
Sql2 = &quot;INSERT INTO PayVoucherID(ApNumber)Values('&quot; &amp; Sheets(&quot;MAX&quot;).Range(&quot;A2&quot;) &amp; &quot;') &quot;
cnn.Execute Sql2
Loop Until (Err.Number = 0)}