button visibility

J

Jeffery

After updating a date feild on a single form, I would like to set the
visibility of a delete button (for the record) to false. I am getting an
error- "object required" on the second line. Any help? Here is the code:

Private Sub DateReceive_AfterUpdate()
If Me.[DateReceive] Is Not Null Then
Me.Delete.Visible = True
Else: Me.Delete.Visible = False
End If
End Sub
 
M

Marshall Barton

Jeffery said:
After updating a date feild on a single form, I would like to set the
visibility of a delete button (for the record) to false. I am getting an
error- "object required" on the second line. Any help? Here is the code:

Private Sub DateReceive_AfterUpdate()
If Me.[DateReceive] Is Not Null Then
Me.Delete.Visible = True
Else: Me.Delete.Visible = False
End If
End Sub


The Is Not Null syntax is only legal in the SQL ad contr
source expression environments.

In VBA, use the IsNull function.

If Not IsNull(Me.[DateReceive]) Then
 
G

Graham Mandeno

Hi Jeffrey

"Delete" is a very common method name in most object models. I suspect that
VBA is trying to interpret Me.Delete an a property or method of the Me
object, not as your command button.

I suggest you change the name of your command button to "cmdDelete".
 
J

Jeffery

Thanks- the change worked fine with no other mods needed.

Marshall Barton said:
Jeffery said:
After updating a date feild on a single form, I would like to set the
visibility of a delete button (for the record) to false. I am getting an
error- "object required" on the second line. Any help? Here is the code:

Private Sub DateReceive_AfterUpdate()
If Me.[DateReceive] Is Not Null Then
Me.Delete.Visible = True
Else: Me.Delete.Visible = False
End If
End Sub


The Is Not Null syntax is only legal in the SQL ad contr
source expression environments.

In VBA, use the IsNull function.

If Not IsNull(Me.[DateReceive]) Then
 

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