Issa S.
asked on
How can I Flash a mandatory field in Access Form?
Hi All,,,
How can I Flash a mandatory field ?
I want to validate a field in a form.
How can flash this field if the user did not enter a value or wrong value in the value.
Thanks
How can I Flash a mandatory field ?
I want to validate a field in a form.
How can flash this field if the user did not enter a value or wrong value in the value.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A third alternative which is a combination of the two techniques above is to color the background of required fields and set focus to the first when when validation fails.
http://allenbrowne.com/highlight.html
This really makes them stand out and easy for the user.
Jim.
http://allenbrowne.com/highlight.html
This really makes them stand out and easy for the user.
Jim.
Agree with the other Experts - don't flash the field, but instead make it stand out in some manner. Flashing fields irritate users, and are a surefire way for you to get feedback (and it won't be good!).
From a UIX point of view, a combination of Joe and Mike's suggestion would work. You should provide visual clues (like Mike suggests) so the user understands which fields are mandatory. The red asterisk is one common mechanism used for that. I wouldn't necessarily hide them, since users typically don't like "magic" controls that show/hide based on logic, but that's your choice. You should also always validate data before it hits the database, to ensure that data conforms to your business logic and rules.
From a UIX point of view, a combination of Joe and Mike's suggestion would work. You should provide visual clues (like Mike suggests) so the user understands which fields are mandatory. The red asterisk is one common mechanism used for that. I wouldn't necessarily hide them, since users typically don't like "magic" controls that show/hide based on logic, but that's your choice. You should also always validate data before it hits the database, to ensure that data conforms to your business logic and rules.
<<The red asterisk is one common mechanism used for that. >>
I know this is a common practice, but it's not a good one. I'm partially color-blind with red/green (like many other males) and I have a tough time spotting red asterisk's on web pages.
Jim.
I know this is a common practice, but it's not a good one. I'm partially color-blind with red/green (like many other males) and I have a tough time spotting red asterisk's on web pages.
Jim.
Agree about the red color, but I think the inclusion of the asterisk (regardless of the color) is the real indicator for most people.
I generally do most validation in the form's BeforeUpdate event. The code stops the save and sets focus to the failing field and exits the sub. In addition you could set the caption to bold and italics and underline. That avoids the color issue that some people have. The problem with modifying properties of captions is that you actually need to toggle them so that they are cleared at the beginning of each execution of the BeforeUpdate event.
Me.lblsomefield.Italics = false
Me.lblSomefield.Bold = false
Me.lblSomefield.Underline = false
If Me.somefield & "" <> "" and Me.somefield > 5 Then
Else
Me.lblsomefield.Italics = true
Me.lblSomefield.Bold = true
Me.lblSomefield.Underline = true
Me.txtsomefield.setfocus
cancel = true
Exit Sub
End If
PS - you highlight the label rather than the textbox because if the textbox is empty, no one will see the highlighting.
Me.lblsomefield.Italics = false
Me.lblSomefield.Bold = false
Me.lblSomefield.Underline = false
If Me.somefield & "" <> "" and Me.somefield > 5 Then
Else
Me.lblsomefield.Italics = true
Me.lblSomefield.Bold = true
Me.lblSomefield.Underline = true
Me.txtsomefield.setfocus
cancel = true
Exit Sub
End If
PS - you highlight the label rather than the textbox because if the textbox is empty, no one will see the highlighting.
ASKER
Thanks to you all Gentlemen : Joe /Mike / Scott / Jim / Scott / Pat
You gave me lot of helpful thoughts that I work in between them.
Now I have work on my homework.
Many Thanks again
You gave me lot of helpful thoughts that I work in between them.
Now I have work on my homework.
Many Thanks again
While I don't agree with the practice of giving everyone a participation award, someone probably helped you more than the others. Perhaps you should wait to close the question until after you decide which method worked the best for you. Most of us agree on two points -
1. Flash is annoying and should not be used for this.
2. It is the (a) label that needs the highlight rather than the field itself.
1. Flash is annoying and should not be used for this.
2. It is the (a) label that needs the highlight rather than the field itself.
The 'Accepted Answer' is not really an answer (as are the other contributions). It's just a comment.
ASKER
Helpful
Sorry for late response as I was on a short travel.
Thanks
Sorry for late response as I was on a short travel.
Thanks
You can use the Form's Before Update Event to validate required fields ... and popup the message box if validation fails. And you can use the Cancel argument to cancel the Before Update event ... forcing the user to fix the issue.