Test whether a form is on the current record

  • Thread starter Thread starter tryit
  • Start date Start date
T

tryit

I want a button to appear only when the current record is the
acNewRec. In pseudocode:

If form is on acNewRec Then
Me.Mybtn.Visible = True
Else
Me.Mybtn.Visible = False
End if

My questions:

Which Form event do I put this in?

What is the correct way to write the If line?


Thanks,
TI
 
So close:

Use the Form's Current event:

Sub Form_Current()
If Me.NewRecord = True Then
Me.Mybtn.Visible = True
Else
Me.Mybtn.Visible = False
End If
End Sub
 
try the following in the form's Current event procedure, as

Me!Mybtn.Visible = Me.NewRecord

hth
 
I want a button to appear only when the current record is the
acNewRec. In pseudocode:

If form is on acNewRec Then
Me.Mybtn.Visible = True
Else
Me.Mybtn.Visible = False
End if

My questions:

Which Form event do I put this in?

What is the correct way to write the If line?

Thanks,
TI

Place the following code in the form's Current event:

Me!Mybtn.Visible = Me.NewRecord
 
So close:

Use the Form's Current event:

Sub Form_Current()
If Me.NewRecord = True Then
    Me.Mybtn.Visible = True
Else
    Me.Mybtn.Visible = False
End If
End Sub

Thank you. And thanks to the others who responded.


TI
 
Back
Top