J
JamesJ
I'm trying to delete a record from a form that has a Listbox populated by
the same tbl as the form. In the OnClick of a delete button I have the
following code:
Public Function DelRecord()
Set frm = Screen.ActiveForm
Dim msg, style, TITLE, Response
msg = "You are about to delete 1 record," & vbCrLf & "Are you sure you
want to do this?"
style = vbYesNo + vbExclamation + vbDefaultButton2
TITLE = "Delete Record"
Response = MsgBox(msg, style, TITLE)
If Response = vbYes Then
frm.RecordsetClone.Bookmark = frm.Bookmark
frm.RecordsetClone.Delete
frm.Requery
lbox.Requery
Else
End If
End Function
I declare frm and lbox in the Declaration section of the module
I get an error message at the lbox.Requery line:
Object variable or With block variable not set.
Any help will be appreciated
James
the same tbl as the form. In the OnClick of a delete button I have the
following code:
Public Function DelRecord()
Set frm = Screen.ActiveForm
Dim msg, style, TITLE, Response
msg = "You are about to delete 1 record," & vbCrLf & "Are you sure you
want to do this?"
style = vbYesNo + vbExclamation + vbDefaultButton2
TITLE = "Delete Record"
Response = MsgBox(msg, style, TITLE)
If Response = vbYes Then
frm.RecordsetClone.Bookmark = frm.Bookmark
frm.RecordsetClone.Delete
frm.Requery
lbox.Requery
Else
End If
End Function
I declare frm and lbox in the Declaration section of the module
I get an error message at the lbox.Requery line:
Object variable or With block variable not set.
Any help will be appreciated
James