On Current Event

G

Guest

Hi, all, I'm trying to set the form's OnCurrent event, if the field "Paid" is
YES, then Due Date controls visible property to No, i guess i must did
something wrong, because it won't work, thank you. Here's my code:
Private Sub Form_Current()
if me! [Paid] = true then
Me![Due Date].Visible = False
Else
Me![Due Date].Visible = True
End If
End Sub
 
R

Rick Brandt

Carol said:
Hi, all, I'm trying to set the form's OnCurrent event, if the field
"Paid" is YES, then Due Date controls visible property to No, i guess
i must did something wrong, because it won't work, thank you. Here's
my code:
Private Sub Form_Current()
if me! [Paid] = true then
Me![Due Date].Visible = False
Else
Me![Due Date].Visible = True
End If
End Sub

Looks good to me. Please clarify "won't work". Do you get an error or just no
change?

Is the field [Paid] a YesNo DataType?

Do you have [Event Procedure] entered into the On Current event property box?
 
G

Guest

Hi Carol

Try this

I have remove the space from Due Date to make it DueDate (try not to have
spaces in field names)


Private Sub Form_Current()
If Me.Paid = True Then
Me.DueDate.Visable = False
Else
Me.DueDate.Visable = True
End If
End Sub
 
G

Guest

Just in case Carol copies and pastes that code... I think there's a little
typo in there (twice): visable should be visible (with an i not an a).
Not trying to be smart or pedantic, Wayne, but I imagine it could cause a
problem...
Thanks
CW

Wayne-I-M said:
Hi Carol

Try this

I have remove the space from Due Date to make it DueDate (try not to have
spaces in field names)


Private Sub Form_Current()
If Me.Paid = True Then
Me.DueDate.Visable = False
Else
Me.DueDate.Visable = True
End If
End Sub


--
Wayne
Manchester, England.
Enjoy whatever it is you do


Carol Shu said:
Hi, all, I'm trying to set the form's OnCurrent event, if the field "Paid" is
YES, then Due Date controls visible property to No, i guess i must did
something wrong, because it won't work, thank you. Here's my code:
Private Sub Form_Current()
if me! [Paid] = true then
Me![Due Date].Visible = False
Else
Me![Due Date].Visible = True
End If
End Sub
 
G

Guest

Hi, Rick
The field [Paid] is a yes/not type, and [event procedure] is on current
event, i also try Wayne-I-M's suggestion not to leave space on [DueDate],
computer show: "compile error, method or data member not found", [Paid]
maeked as blue, something to do with this [Paid] field, let me double check
again, thanks.

Rick Brandt said:
Carol said:
Hi, all, I'm trying to set the form's OnCurrent event, if the field
"Paid" is YES, then Due Date controls visible property to No, i guess
i must did something wrong, because it won't work, thank you. Here's
my code:
Private Sub Form_Current()
if me! [Paid] = true then
Me![Due Date].Visible = False
Else
Me![Due Date].Visible = True
End If
End Sub

Looks good to me. Please clarify "won't work". Do you get an error or just no
change?

Is the field [Paid] a YesNo DataType?

Do you have [Event Procedure] entered into the On Current event property box?
 
G

Guest

you're right i spell it wrong, but the [Paid] still marked blue...and Private
Sub Form_Current() marked yellow...

CW said:
Just in case Carol copies and pastes that code... I think there's a little
typo in there (twice): visable should be visible (with an i not an a).
Not trying to be smart or pedantic, Wayne, but I imagine it could cause a
problem...
Thanks
CW

Wayne-I-M said:
Hi Carol

Try this

I have remove the space from Due Date to make it DueDate (try not to have
spaces in field names)


Private Sub Form_Current()
If Me.Paid = True Then
Me.DueDate.Visable = False
Else
Me.DueDate.Visable = True
End If
End Sub


--
Wayne
Manchester, England.
Enjoy whatever it is you do


Carol Shu said:
Hi, all, I'm trying to set the form's OnCurrent event, if the field "Paid" is
YES, then Due Date controls visible property to No, i guess i must did
something wrong, because it won't work, thank you. Here's my code:
Private Sub Form_Current()
if me! [Paid] = true then
Me![Due Date].Visible = False
Else
Me![Due Date].Visible = True
End If
End Sub
 
V

Van T. Dinh

I am not sure what you meant by "the [Paid] still marked blue .." but if the
declaration

Private Sub Form_Current()

is highlighted in yellow, the code stops on this declaration ...

Do you have a breakpoint (dark brown dot on the left margin of this line)?
If you do, remove it and then click the "Run Sub" button in the "Standard"
Toolbar (or the MenuBar command Run / Run Sub).

Occasionally, Access VBE remember (incorrectly) a previously removed
breakpoint and you end up with a phantom breakpoint without the brown dot
which stops the code erroneously. In this case, try typing a space
character at the end of any line of code, the use the Menubar command Run /
Clear All Breakpoints then re-compile the code and save ... This should get
rigd of the phantom breakpoint and allow your code to run normally.
 

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