Script for Text Box

B

Bob

This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 
D

Douglas J Steele

Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.
 
B

Bob

Thanks Douglas great, can this script be slightly altered so as anything my
than 10 years returns a Blank "" no result

=IIf([cbDateOfBirth]="" Or
IsNull([cbDateOfBirth]),"",funCalcAge(Format("01-Aug-" &
[cbDateOfBirth],"dd/mm/yyyy"),Format(Now(),"dd/mm/yyyy"),1))

Douglas J Steele said:
Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bob said:
This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 
B

Bob

Thanks Douglas great, can this script be slightly altered so as anything
(more)
than 10 years returns a Blank "" no result

Bob said:
Thanks Douglas great, can this script be slightly altered so as anything
my than 10 years returns a Blank "" no result

=IIf([cbDateOfBirth]="" Or
IsNull([cbDateOfBirth]),"",funCalcAge(Format("01-Aug-" &
[cbDateOfBirth],"dd/mm/yyyy"),Format(Now(),"dd/mm/yyyy"),1))

Douglas J Steele said:
Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bob said:
This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 
D

Douglas J. Steele

Assuming you mean that anything more than 10 years, try:

IIf(DateAdd("yyyy", -10, Date()) > Nz([cdDateOfBirth], #1/1/100#), "", ???)

??? means I'm not sure what you want if the age is less than 10. I have no
idea what your funCalcAge is supposed to be doing.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bob said:
Thanks Douglas great, can this script be slightly altered so as anything
my than 10 years returns a Blank "" no result

=IIf([cbDateOfBirth]="" Or
IsNull([cbDateOfBirth]),"",funCalcAge(Format("01-Aug-" &
[cbDateOfBirth],"dd/mm/yyyy"),Format(Now(),"dd/mm/yyyy"),1))

Douglas J Steele said:
Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bob said:
This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 
B

Bob

Thanks, Where do I put this script?

Douglas J. Steele said:
Assuming you mean that anything more than 10 years, try:

IIf(DateAdd("yyyy", -10, Date()) > Nz([cdDateOfBirth], #1/1/100#), "",
???)

??? means I'm not sure what you want if the age is less than 10. I have no
idea what your funCalcAge is supposed to be doing.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bob said:
Thanks Douglas great, can this script be slightly altered so as anything
my than 10 years returns a Blank "" no result

=IIf([cbDateOfBirth]="" Or
IsNull([cbDateOfBirth]),"",funCalcAge(Format("01-Aug-" &
[cbDateOfBirth],"dd/mm/yyyy"),Format(Now(),"dd/mm/yyyy"),1))

Douglas J Steele said:
Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 
D

Douglas J Steele

No idea, since you haven't told me what you're trying to do with it! <g>

Seriously, that expression could be used as a computed cell in a query, it
could be used as the control source for a text box (put an equal sign in
front of it in that case), or it could be included as code within a function
or sub (such as the AfterUpdate event for the Date of Birth text box, or the
Current event for the form)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Bob said:
Thanks, Where do I put this script?

Douglas J. Steele said:
Assuming you mean that anything more than 10 years, try:

IIf(DateAdd("yyyy", -10, Date()) > Nz([cdDateOfBirth], #1/1/100#), "",
???)

??? means I'm not sure what you want if the age is less than 10. I have no
idea what your funCalcAge is supposed to be doing.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bob said:
Thanks Douglas great, can this script be slightly altered so as anything
my than 10 years returns a Blank "" no result

=IIf([cbDateOfBirth]="" Or
IsNull([cbDateOfBirth]),"",funCalcAge(Format("01-Aug-" &
[cbDateOfBirth],"dd/mm/yyyy"),Format(Now(),"dd/mm/yyyy"),1))

Taking your question at face value:

Me.MyTextBox = "[cbStatus]=""Finished"" This text box to be Blank"

(replace MyTextBox with the actual name of your text box)

If that's not what you mean, post back with a better explanation.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



This is what I would like added to my textbox:
[cbStatus]="Finished" This text box to be Blank


Thanks in advance.........Bob Vance
 

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