Add a new record to an access table

P

pogindo

Hi.
I am trying to write a code to add a new record to a table e.g. After
enter record one on the click of the add new button i move to record
two.
Private Sub Add_new_Click()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
Set con = CurrentProject.Connection
strSQL = "SELECT * FROM SampleRequest"
Set rs = New ADODB.Recordset
rs.Open strSQL, con, adOpenDynamic, adLockOptimistic
With rs
.AddNew
.MoveLast
End With
'MsgBox "All phones have been set to ""None""."

End Sub
This is the code it increment the auto number but my screen still
shows the previous entry, but if i scroll through i can see it has
incremented the auto number. Can someone please show what I am not
doing right.
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top