Test whether a form is on the current record

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
 
A

Arvin Meyer MVP

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
 
T

tina

try the following in the form's Current event procedure, as

Me!Mybtn.Visible = Me.NewRecord

hth
 
F

fredg

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
 
T

tryit

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
 

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