Highlight the required fields, or the control that has focus
Thank you for taking the time to report an issue.
What's wrong... Please write below.
Is there an easy way to either make the cursor thicker or highlight a box when it gains focus and de-highlight when it loses focus?
I.e. change txtBox backfill color on focus and change txtBox backfill color (original color of course) off focus.
What am I missing here? I thought that every time the user changes or enters a value in one of the fields on the report, that would be able to trigger a beforeupdate or afterupdate event.
Not the case. If the field is highlighted yellow and the user enters a value and then leaves the field it still stays yellow.
I am trying to avoid having to put the below code behind every one of the 15 required fields on this form.
You can set conditional formatting for a text box or a combo box control. You can change the formatting based on the control's own value, or you can use an expression to change the formatting based on the values contained in other fields or controls. On a form, you can use conditional formatting to disable a control, and you can cause the formatting of a control to change when the cursor is positioned in that control.
What do you want to do?:
*Apply conditional formatting to a control based on its own value
*Use an expression to apply conditional formatting to one or more controls
*Change the formatting of a control on a form that has the focus
*Remove conditional formatting from one or more controls
*Create alternating row colors on a report
I have 100s of Input Controls on my form (TextBox, ComboBox), now what I want is When the control receives Focus I want it's Back Color set to some color say 'Lemon Yellow' to highlight thecontrol & when it leaves focus set it to it's original.
Writing in Enter Event & Leave Event for every control is not quite a good idea.
So I want a trick to handle this with a single or two events.
I have a form where a customer can input data and there are several fields which are required (this requirement is set in the related table).
The Fields on the form that are required are named as follows: txtFirstName txtLastName
Instead of Access giving an error that a certain field is required I would just like to display a generic message of "All Bold Fields are Required." Ideally I would like toaccomplish this by just checking to see if a required field is missing rather than having to list and check each field individually in the form as I have been trying to do:
I am using Access 2010 and am trying to have a bit of VBA code retrieve the value in a form's current control (text box) regardless of which control has focus. For example the following code specifies the name of the control Invoice Number.
stFile = Me![InvoiceNumber]
How would I modify this to retrieve the data not knowing what control has focus
Scenario: A form with some (required) textboxes and some other (not required) controls, a button to save all form's records into a table.
Targets: before saving records the procedure needs to verify: a. if required fields are null (or blank), if some (or all) required fields are blank/null a message has to come up with the name of fields not populated in the form requesting an action by the user. No records have to be writtenin the table if these fields are not filled in.
Better, it works but not very well because the MsgBox comes up even if all required fields are filled in (it doesn't show any field to complete). I know why, the MsgBox is after Next statement, so it comes up every time.
We were using a program that ran in access before where if we surrounded text with an Asterisk * it would automatically highlight it. Something like this would be ideal for what I want to do.
So if a user puts asterisks around a field in a record it will highlight it.
How can I possibly accomplish this?
If I want to read the value in any Textbox, I have to set focus on that Textbox. Obviously we can set focus only on one control at any instant.
After reading the value in the second Textbox(txtDivNr), I lost focus on the first Textbox (txtPName).
This means, in a long sequence of operations, before reading/writing the value in any control,[Control].SetFocus
Is VBA in Access always like that? Maybe I am mistaken, it used to be simpler. I do not remember of explicitly setting the focus on each control.
Or have I done anything wrong in setting up the Form and the controls? The 'tab' control is working OK when tested. I inserted 'unbound' Textboxes in the Form.