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

Disable field if another is full

Status
Not open for further replies.

MrMcFestoe

Technical User
Apr 6, 2003
119
GB
Somebody might have done this, I have three date feilds in a table,

Date level One
Date Level Two
Date withdrawn

What iam trying to do is to only have one field filled at a time, so if level two is filled then a date is entered into any field it clears the previous field, but it must only allow one feild to be filled at any one time.

I have started with a update query but can only get the query to see one field at a time, iam on the right track ?
 
Not sure doing this within the table itself is possible although I haven't tried.

What I would do is create a form and base it on the table in question.

Then for each of your 3 date level fields which would now be bound in '3 text fields' I would put this code in your after update events accordingly.


==========================================
Private Sub DatelevelOne_AfterUpdate()

[DateLevelTwo] = Null
[DateWithdrawn] = Null

End Sub

Private Sub DateLevelTwo_AfterUpdate()

[DateLevelOne] = Null
[DateWithdrawn] = Null

End Sub

Private Sub DateWithdrawn_AfterUpdate()

[DateLevelOne] = Null
[DateLevelTwo] = Null

End Sub
==========================================


Let me know if you have any questions.




[yinyang]
 
ShannonP has the right idea - you can not do this directly at the table level.

On your form, set the EXIT event of each of your date guys to something like this:

If NOT ISNULL({this-date} THEN
OtherDate = Null
OtherDate2 = Null
Else
EndIF

You could probably use the AFTER UPDATE event as well, or even the LOST FOCUS.

Is it possible that ALL THREE could be null?

Think about it.

Jim




Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
Or you could have just one date field and another field with the status, which would have the possible values "level 1","level 2" or "withdrawn".
 
Thanks

Just goning to try it, but pbrodsky good idea to keep it simple. But i need to see all three fields.

MAC
 
Shannonp1

Thanks for the help

Wildhare

One of the fields must always contain a date.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top