Deleting record

  • Thread starter Thread starter Elena Balland
  • Start date Start date
E

Elena Balland

Can you please help me with such trivial thing as deleting record in an
opened form . I found only the way to delete via query, but then the record
deleted is still shows in a form and the moving controls become disabled. I
tried to find the way to move to the previous record and then delete my
record, but whatever I tried most options DoCmd.RunCommand of such as:
acCmdDeleteRecord to delete record instead of query
DoCmd.GoToRecord acDataForm, Me, acPrevious or
DoCmd.GoToRecord , , acPrevious to move to the previous record

I received error messages.
 
Hi,



Assuming the primary key is numerical, something like:


CurrentDb.Execute "DELETE FROM tableName WHERE primaryKey=" &
pkOfTheRecordToBeDeleted


should delete the specified record.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top