delete record from bubform again

G

Guest

Hi,

I have create code to delete the record in the subform as follow:
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "you are about to IRREVERSIBLY DELETE *ALL*INFORMATION CONCERNING
THIS MAIN EQUIPMENT FROM THE DATABASE!?" ' Define message.
Style = vbOKCancel + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "ARE YOU 100% SURE!!!?" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then ' User chose Ok.
Me.AllowDeletions = True
Me.Form_Backstop.Form.r
Me.FORM_conveyor_data.Form.Recordset.Delete
Me.Form_Brake.Form.Recordset.Delete
Me.Form_Backstop.Form.Recordset.Delete
Me.Form_Coupling.Form.Recordset.Delete
Me.Form_CV_GearBox.Form.Recordset.Delete
Me.FORM_CV_pulley.Form.Recordset.Delete
Me.Form_motor_equipment.Form.Recordset.Delete
Me.Form_Instrumentation.Form.Recordset.Delete
Me.[sub equipment details].Form.Recordset.Delete
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If

however this only work if all the forms has some records in it. If one
subform does not has any record this return with a message "no record" then
not thing being delete

anybody has any idea
 
M

MA

hngo said:
Hi,

I have create code to delete the record in the subform as follow:
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "you are about to IRREVERSIBLY DELETE *ALL*INFORMATION
CONCERNING THIS MAIN EQUIPMENT FROM THE DATABASE!?" ' Define
message. Style = vbOKCancel + vbCritical + vbDefaultButton2 '
Define buttons. Title = "ARE YOU 100% SURE!!!?" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then ' User chose Ok.
Me.AllowDeletions = True
Me.Form_Backstop.Form.r
Me.FORM_conveyor_data.Form.Recordset.Delete
Me.Form_Brake.Form.Recordset.Delete
Me.Form_Backstop.Form.Recordset.Delete
Me.Form_Coupling.Form.Recordset.Delete
Me.Form_CV_GearBox.Form.Recordset.Delete
Me.FORM_CV_pulley.Form.Recordset.Delete
Me.Form_motor_equipment.Form.Recordset.Delete
Me.Form_Instrumentation.Form.Recordset.Delete
Me.[sub equipment details].Form.Recordset.Delete
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If

however this only work if all the forms has some records in it. If
one subform does not has any record this return with a message "no
record" then not thing being delete

anybody has any idea
Check if recordcount is > than 0

--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 

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