Access 2007 conditional format when other control selected - formatting

I'm not sure if this is the place to ask about this but I'm pulling my hair out here.
I'm trying to change the backcolor on a textbox (actually a few) when a combobox is selected. I can do it with VBA but I really want to use the conditional formatting. It would make life very simple. It's a large form. Lots of controls and this is for hilighting them when selected. This is one of a group that need to be hilighted when the combobox is selected.
If this isn't the place to ask, please tell me. If not, please help me!! I can't find anything that works. I've been searching for hours.
My understanding is that if the expression is true then it will apply the formatting.
I've tried:
`ActiveControl = [cboVehTwo]`
`[cboVehTwo].ongotfocus = "True"`
And a whole ton of derivatives. Referring to the form, etc...
Any help with the syntax would be appreciated!

VBA deals with events, such as yours: a control getting focus or receiving a click.
Conditional formatting evaluates data to determine format issues.
So you need to use VBA. About "making life very simple" -- use VBA. Conditional formatting is a huge chore to maintain, even if it were appropriate for your case. VBA is comparatively easy to maintain.

Related

Can Access ensure a new form record displays all fields?

I have a database where I don't want some fields showing depending on data in other fields. I'm still new to VBA, having learnt how to do things I need via the internet (there's not much call for it in my job so like to try it out on side projects) for the things I need and have managed to create some code that hides certain fields that aren't needed, depending on what's been entered in another field and that works okay, if not perfectly (I'd like it to only work on the current record and not all of them at once but will worry about that later). My problem is, if I'm entering information onto a record and any of those fields become invisible exactly as I would want them to, then if I have more records to complete and load a new record, those hidden fields are also hidden on the blank record before any data has been entered and I want each new record to show all fields from the outset.
Another thing I've noticed is that if I close the database, next time I go into it the hidden fields have unhidden themselves again so I know I'm missing something important.
Here's a screenshot of a bit of the code where I want 2 other fields (What_reason and Date_sent_to_new_owning_School) to be visible depending on whether the answer in the current field after update is "Standard" or "Non-standard":
I'm sorry if this is really entry-level stuff but I AM entry level and trying to learn. This bit does work, albeit not perfectly as I'd like it to only work on the record I'm in at the time, and not go through and hide that field in all the other records at once (which it's doing).
I've searched everywhere but can't find the answer and although I've tried, I'm nowhere near good enough at VBA to try and use common sense to work it out. Is this something that can be done? I'm okay with computers generally and with Access too but I'm aware there's an awful lot I don't know and this is why I'm trying to do new things and learn stuff that I've not used before. I have tried all day to get this to work but am admitting defeat and am hoping somebody here will be able to help me. I'll probably need 'idiot level' advice if that's possible, I know my limitations. :)
Do you know how to use the Event tab in the Property Sheet? You can set all of your fields to [field].Visible = True on either: On Current, On Load, or On Open
Screenshot of the Property Sheet and for the field that determines the visibility of all of the other fields; you can use the Event: After Update so that way when you click/tab away from that field, it'll make those changes for you!
Property setting affects ALL instances of control. Control will be visible/not visible for all records depending on conditions of current record. Therefore, dynamically hiding controls on form set in Continuous or Datasheet will NOT give the desired result of
only work on the current record and not all of them at once
Db is not going to 'remember' dynamic setting - code needs to be executed when form opens and/or navigating records - so it is needed in OnCurrent event as well as control's AfterUpdate.
Conditional Formatting can dynamically enable/disable textbox/combobox by record although control is still visible.

How to use option buttons to change a value in a Word 2016 table

I am attempting to create a form that uses option buttons to assign a score, which would later be totaled for evaluation purposes. (I am using Word 2016 on Windows 10.)
Here is a pic of a portion of the proposed form, with 5 columns:Proposed Form
Here is a picture of the code I have attempted to use, which worked just exactly as I wanted it to "in EXCEL." Due to needs in other parts of the form, however we will be using Word, not Excel.Code Pic
Since we've decided to use Word, due to other features that Excel lacks, what code should I be using that would place a point value in the "Points" column? (I am assuming e2 to be the address of the 2nd row, 5th column?). I have spent 2 days so far trying to understand how to make this work. I know it can be done, but I lack the specific coding knowledge to make it happen. Thanks in advance for your help!
You appear to be using both formfields and ActiveX controls. It would be far simpler to use just formfields and, instead of having radio buttons, a simple dropdown for each item. That way, you don't need all those separate columns and the results could be tallied from the dropdown selections without the need for VBA.

VBA Macro changing macro

Is it possible to create a macro in MS Office (in this case Word) that will change other macro code? I was trying to find information but no results.
I have a doc which works as a template. Content of template is changed and then saved to another file. However it is important to have current date in it. It cannot be self-updated. Those docs go to folder of people and it is important to know when they get the document, so it must be simply data (or something that does not update).
I was thinking about an on-start event macro that would input current date and on exit it would ask "Do you want self-update functionality" Yes / No
If Yes, delete that event. However I have no idea if it is possible. If it is I still don't know how to search for it.
No this is not possible. In VBA, unlike some lower level languages when you define an event you can not disable it, even using other VBA code.
In C# or VB.NET, Java or C++ you can disable an event by un-wiring it from the handler, but this is not possible in VBA.
Maybe if you be more clear on what you need I can give you a better answer.

How to Make Exception Handling on VBA Excel Form Combobox?

I have this userform that i'm developing for my report formatting task. My whole code is finished, there are only 2 problems that i need to work on.
Making my VBA application work on every excel file that user choose
Exception Handling for ComboBoxes on my form.
(Edit: I hope trying to get attention of people who are interested in this question to another stackoverflow.com topic is not against forum rules)
You guys can reach first problem's topic from here: (There is already one suggestion but i'm little bit confused. So it would be super for alternative suggestions) http://bit.ly/VnF3cK
And about my second problem, when i click empty place of combobox, i can type whatever i want, but i want to restrict it, so users can only choose values [1-5] that i put inside of combobox. How can I achieve this?
In answer to your secondary question, you need to change the ComboBox's Style property to frmStyleDropDownList

limit selections in a listbox in vb.net

I am creating a web control in vb.net that contains a list box. I know that I am able to choose a selection mode of Single or Multiple, but I am interested in limiting a Multiple selection to a predetermined size. For example preventing a user from selecting more than 3 items.
I have tried adding a Validator to the list box, which might be a way forward, but was wondering if there was a way of changing the selection mode to something a bit different than just the two specified ones.
Any ideas or suggestions would be greatly appreciated
Edit: Unfortunately due to project limitations I am unable to use Javascript on this problem. very annoying I know!
You could try handling one of the SelectedIndexChange events. With multiple selection, each time this event fires you can check how many items have already been selected. If it is more than you want, have the handler deselect the one that was just selected. You could also put up a little red label under the listbox saying "Sorry, no more than [n] selections allowed."
EDIT:
Just noticed you said WEB. Same theory applies, but it would have to be done using Javascript.
On the SelectedIndexChanged event, write a short piece of code that will check the number of selected items and if it is greater than your desired amount, unselect the new selection (or unselect the oldest one, or however you wish this to operate).