button visibility

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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".
 
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
 
Back
Top