If you want to check if form exists in database and if found then delete the form .
Here is the code-
Sub check_if_form_exits_delete()
Dim obs As Object
Dim found As Boolean
Dim form_name_to_check As String
form_name_to_check = "sales_detail"
found = False
For Each obj In Application.CurrentProject.AllForms
If obj.Name = form_name_to_check Then
found = True
Exit For
End If
Next
If found = True Then
DoCmd.DeleteObject acForm, form_name_to_check
RefreshDatabaseWindow
MsgBox "Form Found and deleted", vbInformation
Else
MsgBox "Form Not Found", vbInformation
End If
End Sub
Download Access Database
No comments:
Post a Comment