adding records to a table

G

Guest

Hi All,

I have a problem of adding records into table, if the cursor is on the first
record the record that I add replaces the first record and then I moved it to
the last record and the new record replaces that last record in the table.
Is there a method that I can use to make sure this doesn't happen. The thing
is my program was working fine until recently, as I have about 197 records in
that table. Can someone please rescue me.
this is the code that I use to add the record:

On Error GoTo AddErr

With rsemp
If bAddNew Then .AddNew
!empnum = txtEmpNum
!EmpDeptId = cboDept.ItemData(cboDept.ListIndex)
!Title = cboTitle
!lastname = txtLastName
!firstname = txtFirstName
!offloc = cboOffLoc
!officenum = txtOffNum
!OffPhone = Me.txtPhone
!email = txtEmail
.Save
End With
cmdAdd.Enabled = True

cmdSave.Enabled = False
Exit Sub


AddErr:
MsgBox "there was an error " & Err.Number & " " & Err.Description


End Sub
 
C

Cor Ligthert

Nkagi,

Is this VBNet code?

And when it is can you than make it more understandable for somebody who has
not the rest of your program.

By instance

What is rsemp?

Why using "with" while you only use the dot two times in the routine?

Why not using VBNet errorcatching?

Cor.
 

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