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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show field when...

Status
Not open for further replies.

LEPERS

ISP
Feb 13, 2004
1
FR
Please Help!?!

I have a "status" option group on a form with only two options. The default value is option one (this will be the initial value each time a record is created). There are also two date fields. I would like the first date field's value to be the date the record was created. I would then like the second date field's value to be the date option 2 is selected (which will only be on a record update). If possible...I would also like the second date field to be displayed only when option 2 is selected.

Thanks in advance... All help is greatly appreciated!
 
You could put code in the option group's or the option button's OnClick event or AfterUpdate event to set the date in Date2 to =Now(). Then have code in your form's OnActivate or OnOpen events to set the text box's visible property to True or False depending on wether option 1 or 2 is selected. Use the option group's value property to set this. Alex Middleton
 
Hi Leper,

I'll do the second point first:

In your OnCurrent Event code say something like

if not(isnull([Date2])) then
[date2].visible = True
else
[date2].visible = False
endif

For the first part you might try, within the BeforeUpdate Event

If isnull([Date1]) then
' date 1 has not yet been set
[Date1] = date()
else
' Date 1 has been set so this IS an update
[Date2] = date()
endif

I think that'll work - let me know,

Jes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top