Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem hiding button on Form_Current event 2

Status
Not open for further replies.

Gfunk13

Programmer
Feb 28, 2004
17
US
The code below hides btnNxt whether ProdDate is today or not:

Private Sub Form_Current()
If Me!ProdDate = Date Then
Me!btnNxt.Visible = False
Else
Me!btnNxt.Visible = True
End If

On another form, I am using the following code which works fine:

Private Sub Form_Current()
If Me!Text1 = Date Then
Me!btnNextRec.Visible = False
Else
Me!btnNextRec.Visible = True
End If

I haven't mistyped the control names and the properties match almost exactly for both controls on both forms. Even the the properties in the tables behind the control source match.
 
You may try this:
If Me!ProdDate = VBA.Date Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It sounds like some sort of corruption. Delete all of the Current event code you posted and then Compact and Repair. Then key it in again and see what happens.

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Thanks guys.

This worked: If Me!ProdDate = VBA.Date Then
 
You should not have to disambiguate Date, though it seems to have worked for you. I suspect you have used the reserved word Date somewhere as a function or sub or variable and have confused Access.

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top